美文网首页
关于getBoundingClientRect()

关于getBoundingClientRect()

作者: 大菜鸟呀 | 来源:发表于2018-06-29 12:56 被阅读22次

var odiv1=document.getElementById("div1");

odiv1.getBoundingClientRect().width ..........元素的可视宽度

odiv1.getBoundingClientRect().height ..........元素的可视高度

odiv1.getBoundingClientRect().left ..........元素左侧到可视区左侧的距离

odiv1.getBoundingClientRect().top ..........元素顶部到可视区顶部的距离

odiv1.getBoundingClientRect().right ..........元素右侧侧到可视区右侧的距离

odiv1.getBoundingClientRect().bottom .........元素底部到可视区底部的距离

相关文章

网友评论

      本文标题:关于getBoundingClientRect()

      本文链接:https://www.haomeiwen.com/subject/iiqayftx.html