网络编程 
首页 > 网络编程 > 浏览文章

js里取容器大小、定位、距离等属性搜集整理

(编辑:jimmy 日期: 2025/5/16 浏览:3 次 )

element.clientWidth   //元素的实际宽度,不算边框

element.clientHeight  //元素的实际高度,不算边框


element.offsetWidth   //元素的实际宽度,加上边框

element.offsetHeight  //元素的实际高度,加上边框


element.scrollWidth  //这个说法很多,我测试下来应该是元素实际宽度-滚动条的宽度

element.scrollHeight  //这个说法很多,我测试下来应该是元素实际高度-滚动条的高度


element.offsetLeft   //相对于父对象的距离,ie下如果position设为relative,则是相对于window的距离

element.offsetTop   //相对于父对象的距离,ie下如果position设为relative,则是相对于window的距离


window.screenLeft   //当前窗口距离屏幕距离 only for IE

window.screenX   //当前窗口距离屏幕距离 not for IE


window.innerWidth  //当前窗口大小(内)not for IE

window.outerWidth  //当前窗口大小(外)not for IE


window.screen.width //当前屏幕分辨率

window.screen.availWidth //当前屏幕可用分辨率

上一篇:jquery indexOf使用方法
下一篇:没有document.getElementByName方法
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网 网站地图 SiteMap