移动端事件
1.事件顺序
一般事件顺序:touchstart > touchmove > touchend > scroll
(a).点击(各设备统一):
touchstart > touchend
(b).swipe(设备不同,执行顺序不同):
ipad ===> touchstart > touchmove多次 > touchend > scroll(惯性滚动结束)
ios ===> touchstart > touchmove多次 > touchend > scroll
Android ===> touchstart > touchmove > touchcancel >scroll多次
2.事件对象
每个触摸事件会生成一个event对象。
targetTouches/touches:当前屏幕上所有手指的列表
changedTouches:当前事件的手指列表
touch对象包含以下属性:
clentX/clientY:触摸点相对浏览器窗口的位置
pageX/pageY:触摸点相当于页面的位置
screenX/screenY:触摸点相对于屏幕的位置
target:当前的DOM元素
-
近期文章
近期评论
- VaveParo发表在《2017.0922心得》
- boom beach مهكرة发表在《使用javascript控制Flash视频的播放》
- 跨域相关原理及解决办法 | 熊二的技术博客发表在《不同跨域方法的比较》
- 熊二的技术博客发表在《js面向对象设计》
- herbert发表在《javascript图片对象》
文章归档
分类目录
功能
标签