touchmove 事件中获取真正触摸点下方的元素
来源:互联网 发布:网络图标 ppt 下载 编辑:程序博客网 时间:2024/04/30 04:00
前端开发中的touchstart, touchmove, touchend三个事件,点击元素并拖动时,获取到了touchmove事件, 但是event.touches[0].target所指向的元素却是touchstart时获取到的元素,而并非手指所移动到上方的元素,所以在处理获取移动到哪个元素上方之类的需求时,普通方法已不奏效,解决方式如下:
var element = document.elementFromPoint(event.originalEvent.pageX, event.originalEvent.pageY);
这样获取到的即为所需元素。
备注:不同版本可能获取方式不同,有的是利用下面的代码来获取
document.elementFromPoint(event.clientX, event.clientY);
0 0
- touchmove 事件中获取真正触摸点下方的元素
- touchstart,touchmove,touchend触摸事件的小小实践心得
- HTML5屏幕触摸的四个事件touchstart、touchmove、touchend、touchcancel
- 微信中body的touchmove事件(下拉显示网址)影响元素的touchmove事件的解决方法
- 获取触摸的点
- 触摸三事件touchstart,touchend,touchmove
- HTML5触摸事件(touchstart、touchmove和touchend)
- HTML5触摸事件(touchstart、touchmove和touchend)
- HTML5触摸事件(touchstart、touchmove和touchend)
- 【HTML5】触摸事件(touchstart、touchmove和touchend)
- 触摸事件(touchstart、touchmove和touchend)
- HTML5触摸事件(touchstart、touchmove和touchend)
- h5触摸事件:touchstart、touchmove和touchend
- HTML5触摸事件(touchstart、touchmove和touchend)
- HTML5触摸事件(touchstart、touchmove和touchend)
- HTML5触摸事件(touchstart、touchmove和touchend)
- HTML5触摸事件(touchstart、touchmove和touchend)
- HTML5触摸事件(touchstart、touchmove和touchend)
- IOS高级开发~底层实现资源收集
- 南邮数据结构实验1 一元多项式的相加和相乘
- 转一篇国外c调用lua的实用文章
- 初识GNU, GCC, CYGWIN, MINGW, MSYS
- shell 正则截取字符串
- touchmove 事件中获取真正触摸点下方的元素
- ruby 格式化字符串 浮点数
- 进程分配内存的两种方式--brk() 和mmap()(不设计共享内存)
- HDU2137 circumgyrate the string
- qt 之QToolButton
- expect学习笔记-1
- 如何全面系统的了解PMP认证及考试?
- 查看oracle版本信息
- 在sql server数据库中快速删除记录,清空表