擷取頁面高度 jquery javascript 覺得很有用 copy 別人的

來源:互聯網
上載者:User
擷取頁面高度 jquery javascript  覺得很有用 copy 別人的

網頁可見地區寬: 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).width(); 
擷取頁面的文檔高度 :$(document).height(); 
擷取頁面的文檔寬度 :$(document).width();

擷取捲軸到頂部的垂直高度 :$(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

擷取頁面高度 jquery javascript  覺得很有用 copy 別人的

網頁可見地區寬: 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).width(); 
擷取頁面的文檔高度 :$(document).height(); 
擷取頁面的文檔寬度 :$(document).width();

擷取捲軸到頂部的垂直高度 :$(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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.