0
0

タッチイベント追加(JS)

Last updated at Posted at 2023-12-30
// HTML要素を取得
const target = document.querySelector('#target')

// タッチイベントを追加
target.addEventListener('touchstart', (event) => {
  // タッチが開始された時の処理(指が触れた時)
  console.log('開始', event)
})

target.addEventListener('touchmove', (event) => {
  // タッチが移動した時の処理(指を動かした時)
  console.log('移動', event)
})

target.addEventListener('touchend', (event) => {
  // タッチが終了した時の処理(指を離した時)
  console.log('終了', event)
})
0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0