Created
April 20, 2015 12:47
-
-
Save hsnaydd/c9d92ae93bd3b2845dea to your computer and use it in GitHub Desktop.
Javascript offset() function
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
getOffsetSum = (elem)-> | |
top = 0 | |
left = 0 | |
while ( elem ) | |
top = top + parseInt( elem.offsetTop ) | |
left = left + parseInt( elem.offsetLeft ) | |
elem = elem.offsetParent | |
return { top: top, left: left } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment