Created
September 29, 2017 18:58
-
-
Save BKeanu1989/b2b639d797371ede78623c1335baaf74 to your computer and use it in GitHub Desktop.
cumulativeOffset
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
var cumulativeOffset = function(element) { | |
var top = 0, left = 0; | |
do { | |
top += element.offsetTop || 0; | |
left += element.offsetLeft || 0; | |
element = element.offsetParent; | |
} while(element); | |
return { | |
top: top, | |
left: left | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment