-
-
Save remy/360018 to your computer and use it in GitHub Desktop.
Get element from mouse position
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var x,y; | |
document.onmousemove = function(e){ | |
e = e || window.event; | |
x = e.clientX; | |
y = e.clientY; | |
}; | |
function elementAtMousePosition() { | |
return document.elementFromPoint(x,y); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have been struggling to figure out how to make elementFromPoint work. I am implementing a drag & drop using hammer.js and I would like to know when the panend event has fired which is the DOM element beneath the target
http://plnkr.co/edit/jSsELjc4XOKEk1ffq5Qh?p=preview