可惜仅有IE(IE5)很早就支持,chrome DOM就不支持这个方法。除了top left right bottom这几个属性,firefox还增加了width和height属性。
console.log(document.body.getBoundingClientRect());
本文介绍了浏览器中getBoundingClientRect方法的支持情况及其属性。IE5最早支持此方法,但Chrome DOM不支持。除了top、left、right和bottom属性外,Firefox还额外支持width和height属性。
console.log(document.body.getBoundingClientRect());
1435

被折叠的 条评论
为什么被折叠?