ios触摸事件_触摸事件

ios触摸事件

See more on JavaScript events

进一步了解JavaScript事件

Touch events are those events that are triggered when viewing the page on a mobile device, like a smartphone or a tablet.

触摸事件是在智能手机或平板电脑等移动设备上查看页面时触发的事件。

They allow you to track multitouch events.

它们使您可以跟踪多点触控事件。

We have 4 touch events:

我们有4个触摸事件:

  • touchstart a touch event has started (the surface is touched)

    touchstart触摸事件已开始(已触摸表面)

  • touchend a touch event has ended (the surface is no longer touched)

    touchend触摸事件已结束(不再触摸表面)

  • touchmove the finger (or whatever is touching the device) moves over the surface

    touchmove手指(或触摸设备的任何物体)在表面上移动

  • touchcancel the touch event has been cancelled

    touchcancel触摸事件已取消

Every time a touch event occurs we are passed a touch event:

每次发生触摸事件时,我们都会通过一个触摸事件

const link = document.getElementById('my-link')
link.addEventListener('touchstart', event => {
  // touch event started
})

Here are all the properties we can access on that event

这是我们可以在该事件上访问的所有属性

  • identifier an unique identifier for this specific event. Used to track multi-touch events. Same finger = same identifier.

    identifier此特定事件的唯一标识符。 用于跟踪多点触控事件。 同一根手指=相同的标识符。

  • clientX / clientY the x and y coordinates of the mouse pointer relative to the browser window, regardless of scrolling

    clientX / clientY鼠标指针相对于浏览器窗口的x和y坐标,与滚动无关

  • screenX / screenY the x and y coordinates of the mouse pointer in the screen coordinates

    screenX / screenY屏幕坐标中鼠标指针的x和y坐标

  • pageX / pageY the x and y coordinates of the mouse pointer in the page coordinates (including scrolling)

    pageX / pageY页面坐标中鼠标指针的x和y坐标(包括滚动)

  • target the element touched

    target感动元素

翻译自: https://flaviocopes.com/touch-events/

ios触摸事件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值