Capture “tap” event with pure JavaScript

后端 未结 4 579
囚心锁ツ
囚心锁ツ 2020-12-23 16:20

How can I capture a user\'s \"tap\" event with pure JS? I cannot use any libraries, unfortunately.

4条回答
  •  渐次进展
    2020-12-23 17:18

    The click event is triggered on mouse click as well as on a touch click.

    The touchstart event is triggered when the screen is touched.

    The touchend event is triggered when the touch ends. If the default action is prevented, a click event will not trigger.

    http://www.w3.org/TR/touch-events/

提交回复
热议问题