๐ฐcoordinates
browser โฉ concepts โฉ coordinate system
There are 3 different coordinate systems:
document coordinates
viewport coordinates - also called "window coordinates".
container coordinates - relatively positioned container with top/left = 0.
client-side JavaScript tends to use viewport coordinates:
elem.getBoundingClientRect() (DOMRect) size and position (relative to viewport).
document.elementFromPoint() topmost
Element
at specified coordinates (relative to viewport).mouseEvent/touch.clientX, mouseEvent/touch.clientY
๐ window window scrolling
window.scrollTo() takes the x and y coordinates in document coordinates.
๐ CSS position
Last updated