admin管理员组文章数量:1293812
As far as I can tell, the event triggered by ontouchmove
in mobile Safari only contains information about on which element the touch began. For example, let's assume I put my finger down on the element .firstElement
and then drag it across the page until it is over .secondElement
. I've inspected all the properties of the event object, but I can only seem to find references the .firstElement
.
Is there a way to detect with ontouchmove
which element the user's finger is currently touching?
As far as I can tell, the event triggered by ontouchmove
in mobile Safari only contains information about on which element the touch began. For example, let's assume I put my finger down on the element .firstElement
and then drag it across the page until it is over .secondElement
. I've inspected all the properties of the event object, but I can only seem to find references the .firstElement
.
Is there a way to detect with ontouchmove
which element the user's finger is currently touching?
- Wouldn't that be eligible to the drag & drop API? – Ricardo Tomasi Commented Nov 20, 2011 at 4:31
- This is ios safari, not firefox. – maxedison Commented Nov 21, 2011 at 14:46
1 Answer
Reset to default 11 +150This appears to be a duplicate of How to find out the actual event.target of touchmove javascript event?
According to that answer, there is no data in the event object that references the element that the finger is currently over. You can, however determine it with the following code:
var secondElement = document.elementFromPoint(event.clientX, event.clientY);
本文标签:
版权声明:本文标题:javascript - ontouchmove: Detecting the new element being touched when moving a touch across multiple elements - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741576387a2386308.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论