Created
April 9, 2019 12:01
-
-
Save webag/e03e9ee58f6ce9170369eca76737fe5f to your computer and use it in GitHub Desktop.
Позиция элемента на странице js. Elem position
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getCoords(elem) { | |
const box = elem.getBoundingClientRect(); | |
return { | |
top: box.top + pageYOffset, | |
left: box.left + pageXOffset | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment