












利用:getBoundingClientRect 获取元素相对窗口的位置和大小
function test(){
var box = document.getElementById("btn1");
var pos = box.getBoundingClientRect();
console.log("top:"+pos.top +
"left:"+pos.left +
"bottom:"+pos.bottom +
"right:"+pos.right +
"width:"+pos.width +
"height:"+pos.height);
}
fffffffffffffffff
test red font.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。