Created
August 29, 2011 14:41
-
-
Save hotoo/1178528 to your computer and use it in GitHub Desktop.
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
javascript:(function(id){ | |
var getOffset = function(z) { | |
var x=0, y=0; | |
while (z) { | |
x += z.offsetLeft; | |
y += z.offsetTop; | |
z = z.offsetParent; | |
} | |
return [x, y]; | |
}; | |
var elem = document.getElementById(id); | |
alert(getOffset(elem)); | |
})("container");void(0); | |
javascript:(function(id){var getOffset=function(z){var x=0,y=0;while(z){x+=z.offsetLeft;y+=z.offsetTop;z=z.offsetParent;}return [x,y];};var elem=document.getElementById(id);alert(getOffset(elem));})("container");void(0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment