您的位置:首页 > 运维架构

Offset,Client,Scroll,Height,Top 一些距离参数的图示和解释

2012-05-28 16:30 162 查看
先上一张神图



按上右下左的顺序来:

1.clientTop,clientLeft

等于borderTop,borderLeft,就是border的宽度

2.ScrollTop,ScrollLeft

padding+border宽度+已滚动的高度/宽度



3.OffsetTop,OffsetLeft

offsetTop returns
the distance of the current element relative to the top of the 
offsetParent
 node.

OffsetTop返回当前元素相对OffsetParent节点顶部的距离

offsetParent returns
a reference to the object which is the closest (nearest in the containment hierarchy) positioned containing element. If the element is non-positioned, the nearest table cell or root element (
html
 in
standards compliant mode; 
body
 in
quirks rendering mode) is the offsetParent. offsetParent returns
null when the element has 
style.display
 set
to "none". TheoffsetParent is
useful because offsetTop and offsetLeft are
relative to its padding edge.

OffsetParents返回一个离object最近的确定位置的包含元素的引用

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐