获取元素offset的方法

function getoffset(e) {
var t = e.offsetTop;
var l = e.offsetLeft;
while (e = e.offsetParent) {
t += e.offsetTop;
l += e.offsetLeft;
}
var result = {};
result.offsetTop = t;
result.offsetLeft = l;
return result;
}

你可能感兴趣的:(set)