开发者

JavaScript: elementFromPoint(x,y)

开发者 https://www.devze.com 2023-03-08 22:54 出处:网络
Hey guys, I\'m writing a Firefox plugin and using the following function: var obj = page.elementFromPoint(x,y); //x,y are the mouse coordinates

Hey guys, I'm writing a Firefox plugin and using the following function:

var obj = page.elementFromPoint(x,y); //x,y are the mouse coordinates

However this function returns the topmost element which lies under the given point. This isn't good enough for me, I need the most inner element which lies under the given point. Does anyone know how to do it?

Thanks开发者_JS百科


Gecko and WebKit support the style pointer-events: none; to prevent pointer events on the element obscuring the one you want to find, but generally you can only manually search the DOM tree. Or set display: none; to the elements you don't want to get before you use elementFromPoint, if that is possible in your setup.

0

精彩评论

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