0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

pointerEventメモ

Posted at

マウスアクションでできるPointer Eventsで使いそうなイベントをメモ

const mouseEventContent = document.getElementById('mouseEventContent');
mouseEventContent.addEventListener('pointerover', (event) => {
  console.log('ポインターが要素内に入った');
});
mouseEventContent.addEventListener('pointerout', (event) => {
  console.log('ポインターが要素外に出た');
});
mouseEventContent.addEventListener('pointerdown', (event) => {
  console.log('マウスクリック');
});
mouseEventContent.addEventListener('pointermove', (event) => {
  console.log('マウスを要素内で動かした');
});
mouseEventContent.addEventListener('pointerup', (event) => {
  console.log('マウスクリックアップ');
});

現在はPCの他にスマホからもWEBにアクセスできるので、異なるデバイスでも同じ動作をさせようとするのは一工夫必要。
難しい場合はWebまたはスマホ専用サイトとして設計することも考慮する

参考

0
0
0

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?