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?

Share edited Nov 25, 2019 at 23:27 Brian Tompsett - 汤莱恩 5,89372 gold badges61 silver badges133 bronze badges asked Nov 11, 2011 at 13:50 maxedisonmaxedison 17.6k15 gold badges71 silver badges118 bronze badges 2
  • 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
Add a ment  | 

1 Answer 1

Reset to default 11 +150

This 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);

本文标签: