scrollWidth: //內(nèi)容的總寬度, 只能獲取不能修改
scrollHeight: //內(nèi)容的總高度,只能獲取不能修改

clientWidth和clientHeight.png
scrollLeft: //內(nèi)容往左邊滾出去的距離
scrollTop: //內(nèi)容往上邊滾出去的距離
//這兩個可以設(shè)置距離,但是如果設(shè)置的值超出它本身最大能滾出去的大小,那就會滾到最后

scroll.png
兼容寫法
獲取頁面滾出去的距離是有比較復(fù)雜的兼容性問題,所以要用下面代碼獲取滾出去的距離
var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
var scrollLeft = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0;