get element position 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: js get element by X Y
// get the element at a certain (x, y) position
var element = document.elementFromPoint(x, y);
// for a list of elements
var elements = document.elementsFromPoint(x, y);
.