开发者

find element at an absolute position

开发者 https://www.devze.com 2022-12-27 02:53 出处:网络
How would you u开发者_运维知识库se jquery to get the element at a particular x, y coordinate? You can .offset and .position to find absolute and relative position using jquery. Like this:

How would you u开发者_运维知识库se jquery to get the element at a particular x, y coordinate? You can .offset and .position to find absolute and relative position using jquery.


Like this:

$(document.elementFromPoint(x, y))


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号