js set relative position of element to parent code example
Example: javascript get element position relative to document
element.getBoundingClientRect().top + document.documentElement.scrollTop
element.getBoundingClientRect().top + document.documentElement.scrollTop