且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

getElement的位置?

更新时间:2023-02-08 16:38:15

var yourElement = document.elementFromPoint(10, 10);

这是一个有效的工作示例,用于更改指定点处元素的背景颜色。

Here's a working example that changes the background colour of the element at the specified point.

请注意,如果指定的点位于文档的可见区域, elementFromPoint 将返回 null

Note that if the specified point is outside the visible area of the document, elementFromPoint will return null.