touchstart 事件
定义和用法
touchstart 事件在用户触摸一个元素时发生。
注释:touchstart 事件仅适用于带有触摸屏的设备。
提示:以下是其他与 touchstart 事件相关的事件:
- touchend - 当用户触摸元素时发生
- touchmove - 当用户从元素上移开手指时发生
- touchcancel - 当用户在屏幕上移动手指时发生
语法
在 HTML 中:
<element ontouchstart="myScript">
在 JavaScript 中:
object.ontouchstart = myScript;
在 JavaScript 中,使用 addEventListener() 方法:
object.addEventListener("touchstart", myScript);
技术细节
冒泡: | Supported |
---|---|
可取消: | Supported |
Event Type: | TouchEvent |
Supported HTML Tags: | All HTML Elements |
Browser Support
The numbers in the table indicate the first browser version that fully supports the event.
Event | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
touchstart | 22.0 | 12.0 | 52 | Not Supported | Not Supported |