How to get the element's position (left & top) relative to its parent?
Note: the parent position
is neither relative
nor absolute
, so offsetLeft
& offsetTop
wouldn't work.
The parent/child might have margins/borders/paddings.
Vanilla JS only, no jquery.