client/scroll/offset width/height/top/left (盒模型為contentBox,定位原點是元素左上角邊框最外層的交點)
clientWidth width+左padding+右padding(如果有豎滾動條,那么要減去17px) clientHeight height+上padding+下padding(如果有橫滾動條,那么要減去17px) clientTop border-top-width上邊框寬度 clientLeft border-left-width 左邊框寬度 offsetHeight 同下 offsetWidth borderLeftWidth + paddingLeft + width + paddingRight + borderRightWidth offsetLeft 當前元素原點相對于定位父元素左上角邊框最內層交點的左偏移量 offsetTop 當前元素原點相對于定位父元素左上角邊框最內層焦點的上偏移量 offsetParent 相對于偏移的父元素 scrollHeight 如果元素無豎滾動條,paddingLeft + width + paddingRight. 如果有豎滾動條,那么和內容占用的寬度有關,具體怎么算的還沒搞清楚。 scrollWidth 類似上面 scrollLeft 橫滾動條滾過的長度 scrollTop 豎滾動條滾過的長度
新聞熱點
疑難解答