Skip to content

Instantly share code, notes, and snippets.

@zhuzhuaicoding
Created March 17, 2014 02:34
Show Gist options
  • Select an option

  • Save zhuzhuaicoding/9593019 to your computer and use it in GitHub Desktop.

Select an option

Save zhuzhuaicoding/9593019 to your computer and use it in GitHub Desktop.
getPos
function getPos(obj){var obj1=obj2=obj;var l=obj.offsetLeft;var t=obj.offsetTop;while(obj1=obj1.offsetParent)
l+=obj1.offsetLeft;while(obj2=obj2.offsetParent)
t+=obj2.offsetTop;var rg=QZFL.dom.getPosition(obj);return{top:t,left:l,width:rg.width,height:rg.height};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment