How can I retrieve the offset of a container relative to a parent with pure JS?
element.offsetLeft
and element.offsetTop
give an element's position with respect to its offsetParent
(which is the nearest parent element with a position of relative
or absolute
.)