Last updated 3 years ago
Was this helpful?
🔰 JS ⟩ browser ⟩ DOM ⟩ types ⟩ Document ⟩ methods ⟩ .elementFromPoint
returns the innermost (most deeply nested) and topmost (highest CSS z-index) element at that point (relative to the viewport).
the coordinates are relative to the viewport.
returns null if the point is out of viewport.
💾 replit: document.elementFromPoint()
// viewport const viewport = { // .width, .height width : window.innerWidth, height: window.innerHeight, // .center get
Document ⟩ .elementFromPoint()
JS.info ⟩ elementFromPoint(x, y)
Element
coordinates relative to viewport.