Skip to content Skip to sidebar Skip to footer

Find Element At An Absolute Position

How would you use jquery to get the element at a particular x, y coordinate? You can .offset and .position to find absolute and relative position using jquery.

Solution 1:

Like this:

$(document.elementFromPoint(x, y))

Solution 2:

Provided you know the exact coordinates relative to the document:

functiongetElsAt(top, left){return $("body").find("*").filter(function(){return $(this).offset().top == top && $(this).offset().left == left})}

The other answer stops at the first overlay.

Post a Comment for "Find Element At An Absolute Position"