Skip to content

Instantly share code, notes, and snippets.

@mosfet1kg
Created March 5, 2017 11:26
Show Gist options
  • Save mosfet1kg/154e695327c5f6a9f920a3698d9ab0b1 to your computer and use it in GitHub Desktop.
Save mosfet1kg/154e695327c5f6a9f920a3698d9ab0b1 to your computer and use it in GitHub Desktop.
GET DOM Position with Angular
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