snippet
Get position for relative element on the document
This function allows to retrieve the position of an element, it returns the left and top positions of the element in relation to the document.
const getPosition = (ele) => ((r = ele.getBoundingClientRect()), { left: r.left + window.scrollX, top: r.top + window.scrollY });
Related snippets |
---|