Is there a javascript (or jQuery) function that will allow you to pass in an X and Y coordinate and have it return the DOM element at that position?
I have found functions like element.getBoundingClientRect()
and jQuery's offset()
and position()
, but these are doing the reverse of what im looking for. They provide the coordinates of an element.
Im hoping that the solution isnt to index all of the elements and their coordinates into some kind of map/array and traverse it. As anytime you moved any elements or scrolled the page you'd need to re-index the entire map/array.