find image position in relatio to top of document js code example
Example 1: javascript get div x y position
window.scrollY + document.querySelector('#elementId').getBoundingClientRect().top // Y
window.scrollX + document.querySelector('#elementId').getBoundingClientRect().left // X
Example 2: javascript get element position relative to document
element.getBoundingClientRect().top + document.documentElement.scrollTop