Created
September 11, 2020 16:28
-
-
Save lumixraku/aa0a1afa914141198167dfc9a1f34aaa to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const getOffset = el => { | |
const { | |
top, | |
left | |
} = el.getBoundingClientRect() | |
const { | |
scrollTop, | |
scrollLeft | |
} = document.body | |
return { | |
top: top + scrollTop, | |
left: left + scrollLeft | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment