client offset scroll

1、Client  不可以写

clientWidth      width+ paddingLeft+paddingRight

clientHeight    height+paddingTop +paddingBottom

 

clientTop/clientLeft     borderWidth

 

 

 2、Offset  不可写

offsetHeight/Width  Width/Height + padding +border

 offsetParent  父级参照物  跟Dom结构无关  定位可以改变元素原来的offsetPrent 

最顶层的参照物为body

offsetTop/offsetLeft   当前元素外边框距离其父级参照物内边框的偏移距离

 

 

3、Scroll

scrollHeight / scrollWidth  实际内容高度/宽度

 

scrollTop/scrollLeft    可读写   最小值为0   最大为边界值 (大于或小于都是无效 返回最小值0或边界值)

 边界最大值 =  scrollHeight   -  clientheight  

 

document.documentElement.scrollHeight || document.body.scrollHeight   

posted on 2017-12-26 11:52  cm笔记簿  阅读(120)  评论(0编辑  收藏  举报

导航