深刻了解offsetTop,offsetLeft,offsetWidth,offsetHeight,scrollTop,scrollLeft,scrollWidth,scrollHeight,clientHeight,clientWidth
2011-06-23 14:53
701 查看
首先offsetTop,offsetLeft,offsetWidth,offsetHeight,scrollTop,scrollLeft,scrollWidth,scrollHeight,clientHeight,clientWidth单位都是px
关于offsetTop,offsetLeft,offsetWidth,offsetHeight这4个值,下图很清楚的阐明了。
scrollTop:指被“卷”起来的部分的高度,可以是浏览器也可以是html容器。
scrollLeft:同理上,这个只是向左的距离。
scrollHeight:文档所有内容的高度,包括被“卷”起来的部分高度+当前可见高度+底部未出现的高度
scrollWidth:同理上
clientHeight:当前可见高度
clientWidth:同理上
关于offsetTop,offsetLeft,offsetWidth,offsetHeight这4个值,下图很清楚的阐明了。
scrollTop:指被“卷”起来的部分的高度,可以是浏览器也可以是html容器。
scrollLeft:同理上,这个只是向左的距离。
scrollHeight:文档所有内容的高度,包括被“卷”起来的部分高度+当前可见高度+底部未出现的高度
scrollWidth:同理上
clientHeight:当前可见高度
clientWidth:同理上
相关文章推荐
- offsetTop、offsetLeft、offsetWidth、offsetHeight,scrollTop、scrollLeft、scrollWidth、scrollHeight ,clientHeight、offsetHeight
- scrollWidth,offsetWidth,clientWidth,width;scrollHeight,offsetHeight,clientHeight,height;offsetTop,scrollTop,top;offsetLeft,scrol
- offsetLeft,offsetTop,offsetHeight,offsetWidth,scrollTop,scrollLeft,scrollHeight,scrollWidth
- offsetTop.offsetLeft,offsetWidth,offsetHeight,offsetParent,scrollTop,scrollLeft,scrollWidth,scrollHeight区别
- scrollHeight,scrollLeft,scrollTop,scrollWidth,offsetHeight,offsetLeft,offsetTop,event.clientX,event.clientY
- 四种浏览器对 clientHeight、offsetHeight、scrollHeight、clientWidth、offsetWidth 和 scrollWidth 的解释差异
- :元素大小与位置offsetLeft offsetTop offsetWidth offsetHeight clientWidth clientHeight scrollWidth scrollHei
- DOM中的scrollWidth(Height/Left/Top),offsetWidth(Height/Left/Top)以及clientWidth(Height/Left/Top)
- 四种浏览器对 clientHeight、offsetHeight、scrollHeight、clientWidth、offsetWidth 和 scrollWidth 的解释差异
- client/scroll/offset width/height/top/left ---记第一篇博客
- clientHeight、offsetHeight、scrollHeight、clientWidth、offsetWidth 和 scrollWidth
- JavaScript获取浏览器高度和宽度值(documentElement,clientHeight,offsetHeight,scrollHeight,scrollTop,offsetParent,
- JavaScript获取浏览器高度和宽度值(documentElement,clientHeight,offsetHeight,scrollHeight,scrollTop,offsetParent,offsetY,innerHeight)
- CSS专题(二):元素大小与位置offsetLeft offsetTop offsetWidth offsetHeight clientWidth clientHeight scrollWidth s
- JavaScript获取浏览器高度和宽度值(documentElement,clientHeight,offsetHeight,scrollHeight,scrollTop,offsetParent,
- offsetTop,offsetLeft,offsetWidth,offsetHeight,scrollLeft,scrollWidth,clientWidth详细
- 四种浏览器对 clientHeight、offsetHeight、scrollHeight、clientWidth、offsetWidth 和 scrollWidth 的解释差异
- top、postop、scrolltop、offsetTop、scrollHeight、offsetHeight、clientHeight
- JavaScript获取浏览器高度和宽度值(documentElement,clientHeight,offsetHeight,scrollHeight,scrollTop,offsetParent,offsetY,innerHeight)
- javascript---之clientWidth、clientHeight、offsetWidth、offsetHeight、scrollWidth、scrollHeight等窗口属性说明