开发者

find element at an absolute position

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜