Given absolute or relative position (top & left) is there any way to get the nearest html element to these co-ordinates?
Or alternately, is there any way to craft a selector (or use some jQuery construct) to enumerate elements and then find which is closes to the provided co-ordinates? Assume that the set of elements is small and finite.
I’ve built a jQuery method that returns closest element to offset, within the collection:
Notes:
Use it like this: