标签:
获取元素到body的距离:
<script>
function offsetDis(obj) {
var l = 0, t = 0;
while(obj) {
l = l + obj.offsetLeft + obj.clientLeft;
t = t + obj.offsetTop + obj.clientTop;
obj = obj.offsetParent;
}
return {left: l, top: t};
}
</script>
标签:
原文地址:http://www.cnblogs.com/handsomehan/p/5858974.html