window.screen

window.screen.availWidth returns the current width of the screen (blank space)
window.screen.availHeight returns the current screen height (blank space) (1160 pixels, less than 40 pixels ??? )
window.screen.width returns the current screen width (resolution value) $ (window) .width () is the width of the browser window
window.screen.height returns the current screen height (resolution value)
window.document.body.offsetWidth; return to the current page width (width of the page is 1904, less 16 pixels ???? )

window.document.body.offsetHeight; return the current page height (if only one page is 100 pixels high div, this value will be 100px)

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2     <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 3     <head>
 4         <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
 5         <title>window.screen</title>    
 6         <script type="text/javascript" src='js/jquery.js'></script>    
 7         <script type="text/javascript">            
 8             $(function(){
 9                 console.log(window.screen.availWidth);             //1920
10                 console.log(window.screen.availHeight);             //1160
11                 console.log(window.screen.width);                 //1920
12                 console.log(window.screen.height);                 //1200
13                 console.log(window.document.body.offsetWidth);   //1904
14                 console.log(window.document.body.offsetHeight);     //500
15             })
16         </script>
17     </head>
18     <body>        
19         <div style='width:100px; height:500px;'></div>
20     </body>
21     </html>    

 

Reproduced in: https: //www.cnblogs.com/positive/p/3444928.html

Guess you like

Origin blog.csdn.net/weixin_33795093/article/details/93495703