Skip to content

Instantly share code, notes, and snippets.

@SirPepe
Created November 30, 2011 11:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SirPepe/1408739 to your computer and use it in GitHub Desktop.
Save SirPepe/1408739 to your computer and use it in GitHub Desktop.
FindePos
// Quelle: http://www.quirksmode.org/js/findpos.html
function findPos(obj){
var curleft = 0, curtop = 0;
if(obj.offsetParent){
do {
curleft += obj.offsetLeft;
curtop += obj.offsetTop;
} while(obj = obj.offsetParent);
}
return [curleft, curtop];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment