📅  最后修改于: 2022-03-11 15:00:43.784000             🧑  作者: Mango
function getPos(el) {
// yay readability
for (var lx=0, ly=0;
el != null;
lx += el.offsetLeft, ly += el.offsetTop, el = el.offsetParent);
return {x: lx,y: ly};
}