javascript:
可視區域寬 :document.documentElement.clientWidth (width + padding)
可視區域高 :document.documentElement.clientHeight (height + padding)
可視區域寬: document.body.offsetWidth (包括邊線的寬: width + padding + border)
可視區域高: document.body.offsetHeight (包括邊線的高:height + padding + border)
內容高 : document.body.scrollHeight
文檔高 : document.body.offsetHeight
縱向滾動的距離 : document.body.scrollTop || document.documentElement.scrollTop
橫向滾動的距離 : document.body.scrollLeft || document.documentElement.scrollLeft
jquery:
可視區域寬 : $(window).width()
可視區域高 :$(window).height()
頁面的文檔寬 :$(document).width();
頁面的文檔高 :$(document).height();
獲取滾動條到左邊的垂直寬度 :$(document).scrollLeft();
獲取滾動條到頂部的垂直高度 :$(document).scrollTop();javascript