javascript
網頁可見區域寬: document.body.clientWidth
網頁可見區域高: document.body.clientHeight
網頁可見區域寬: document.body.offsetWidth (包括邊線的寬)
網頁可見區域高: document.body.offsetHeight (包括邊線的高)
網頁正文全文寬: document.body.scrollWidth
網頁正文全文高: document.body.scrollHeight
網頁被卷去的高: document.body.scrollTop
網頁被卷去的左: document.body.scrollLeft
網頁正文部分上: window.screenTop
網頁正文部分左: window.screenLeft
屏幕分辨率的高: window.screen.height
屏幕分辨率的寬: window.screen.width
屏幕可用工作區高度: window.screen.availHeight
屏幕可用工作區寬度: window.screen.availWidth
jquery
獲取瀏覽器顯示區域的高度 : (window).height();獲取瀏覽器顯示區域的寬度:(window).height();獲取瀏覽器顯示區域的寬度:(window).width();
獲取頁面的文檔高度 :(document).height();獲取頁面的文檔寬度:(document).height();獲取頁面的文檔寬度:(document).width();
獲取滾動條到頂部的垂直高度 :(document).scrollTop();獲取滾動條到左邊的垂直寬度:(document).scrollTop();獲取滾動條到左邊的垂直寬度:(document).scrollLeft();
計算元素位置和偏移量
offset方法是一個很有用的方法,它返回包裝集中第一個元素的偏移信息。默認情況下是相對body的偏移信息。結果包含 top和left兩個屬性。
offset(options, results)
options.relativeTo 指定相對計 算偏移位置的祖先元素。這個元素應該是relative或absolute定位。省略則相對body。
options.scroll 是否把 滾動條計算在內,默認TRUE
options.padding 是否把padding計算在內,默認false
options.margin 是否把margin計算在內,默認true
options.border 是否把邊框計算在內,默認true
聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com