js calculate where element is postition to body code example
Example: javascript get element position relative to document
element.getBoundingClientRect().top + document.documentElement.scrollTop
element.getBoundingClientRect().top + document.documentElement.scrollTop