This article is a mirror article of machine translation, please click here to jump to the original article.

View: 15044|Reply: 1

[JavaScript] JS/JQ gets the height and width of various screens

[Copy link]
Posted on 6/20/2017 3:01:43 PM | | |
Javascrip{filter}t:

Web page visibility area: document.body.clientWidth
Web page visibility area height: document.body.clientHeight
Web page visible area width: document.body.offsetWidth (including the width of the edge)
Web Visible Area Height: document.body.offsetHeight (including the height of the edges)
The full text width of the web page: document.body.scrollWidth
Full text height: document.body.scrollHeight
The page is scrolled high: document.body.scrollTop
The page is scrolled to the left: document.body.scrollLeft
On the body of the web page: window.screenTop
Left of the body of the web page: window.screenLeft
High screen resolution: window.screen.height
Width of screen resolution: window.screen.width
Screen available workspace height: window.screen.availHeight
Screen available workspace width: window.screen.availWidth



JQuery:

$(document).ready(function(){
alert($(window).height()); The height of the viewable area of the browser's current window
alert($(document).height()); The height of the document in the browser's current window
alert($(document.body).height()); The height of the browser's current window document body
alert($(document.body).outerHeight(true)); The total height of the browser's current window document body includes the border padding margin

alert($(window).width()); The width of the viewable area of the browser's current window
alert($(document).width()); The width of the document object in the browser's current window
alert($(document.body).width()); The width of the browser's current window document body
alert($(document.body).outerWidth(true)); The total width of the browser's current window document body includes the border padding margin

})





Previous:Administrative division code GB/T 2260 database script of the People's Republic of China
Next:HTML5 exits full-screen events and listens for ESC key events
Posted on 4/24/2018 2:20:12 PM |
Save for later ~
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com