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.

Answers:

Answer

Like this:

$(document.elementFromPoint(x, y))
Answer

Provided you know the exact coordinates relative to the document:

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

The other answer stops at the first overlay.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.