Created
March 5, 2017 11:26
-
-
Save mosfet1kg/154e695327c5f6a9f920a3698d9ab0b1 to your computer and use it in GitHub Desktop.
GET DOM Position with Angular
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
console.log( cumulativeOffset( el[0].children[0]) ); | |
function cumulativeOffset(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