当前位置:网站首页>JS to get the browser and screen height
JS to get the browser and screen height
2022-04-23 21:23:00 【Sister Chunfeng】
Javascript:
IE in :
document.body.clientWidth ==> BODY Object width
document.body.clientHeight ==> BODY Object height
document.documentElement.clientWidth ==> The width of the visible area
document.documentElement.clientHeight ==> Height of visible area
FireFox in :
document.body.clientWidth ==> BODY Object width
document.body.clientHeight ==> BODY Object height
document.documentElement.clientWidth ==> The width of the visible area
document.documentElement.clientHeight ==> Height of visible area
Opera in :
document.body.clientWidth ==> The width of the visible area
document.body.clientHeight ==> Height of visible area
document.documentElement.clientWidth ==> Page object width ( namely BODY Object width plus Margin wide )
document.documentElement.clientHeight ==> Page object height ( namely BODY Object height plus Margin high )
alert(document.body.clientWidth); // Page visible area width (body)
alert(document.body.clientHeight); // Page visible area high (body)
alert(document.body.offsetWidth); // Page visible area width (body), Include border、margin etc.
alert(document.body.offsetHeight); // Page visible area width (body), Include border、margin etc.
alert(document.body.scrollWidth); // Full text width of web page body , Include the unseen area with scroll bar
alert(document.body.scrollHeight); // Page body full text height , Include the unseen area with scroll bar
alert(document.body.scrollTop); // Web pages are rolled away Top( Scroll bar )
alert(document.body.scrollLeft); // Web pages are rolled away Left( Scroll bar )
alert(window.screenTop); // Browser distance Top
alert(window.screenLeft); // Browser distance Left
alert(window.screen.height); // High screen resolution
alert(window.screen.width); // Width of screen resolution
alert(window.screen.availHeight); // The height of the screen's usable workspace
alert(window.screen.availWidth); // The width of the screen's usable workspace
Jquery
alert($(window).height()); // The height of the viewable area of the browser's current window
alert($(document).height()); // The height of the browser's current window document
alert($(document.body).height()); // Browser current window document body Height
alert($(document.body).outerHeight(true)); // Browser current window document body The total height of Include border padding margin
alert($(window).width()); // The width of the viewable area of the browser's current window
alert($(document).width()); // Browser current window document object width
alert($(document.body).width()); // Browser current window document body Width
alert($(document.body).outerWidth(true)); // Browser current window document body Total width of Include border padding margin
版权声明
本文为[Sister Chunfeng]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/110/202204200620164144.html
边栏推荐
- Thread safe sigleton (singleton mode)
- 1. Finishing huazi Mianjing -- 1
- Express③(使用Express编写接口、跨域有关问题)
- Sklearn function: Train_ Test_ Split (split training set and test set)
- [leetcode sword finger offer 10 - II. Frog jumping steps (simple)]
- Flomo software recommendation
- Go limit depth traversal of files in directory
- Chrome 94 引入具有争议的 Idle Detection API,苹果和Mozilla反对
- Solve importerror: cannot import name 'imread' from 'SciPy misc‘
- Opencv reports an error. Expected PTR < CV:: UMAT > for argument '% s'‘
猜你喜欢
亚马逊和Epic将入驻,微软应用商城向第三方开放
The more you use the computer, the slower it will be? Recovery method of file accidental deletion
Centos7 builds MySQL master-slave replication from scratch (avoid stepping on the pit)
Opencv application -- jigsaw puzzle
[※ leetcode refers to offer 32 - II. Print binary tree II from top to bottom (simple)]
[leetcode refers to offer 22. The penultimate node in the linked list (simple)]
[leetcode refers to the substructure of offer 26. Tree (medium)]
C, print the source program of beautiful bell triangle
Pipes and xargs
Addition, deletion, modification and query of MySQL advanced table
随机推荐
Crisis is opportunity. Why will the efficiency of telecommuting improve?
Pytorch: runtimeerror: an attempt has been made to start a new process Error reporting (resolved)
Addition, deletion, modification and query of MySQL advanced table
thinkphp5+数据大屏展示效果
airbase 初步分析
Detectron2 usage model
Keras. Layers introduction to various layers
Amazon and epic will be settled, and the Microsoft application mall will be opened to third parties
Question brushing plan - depth first search (II)
2. Finishing huazi Mianjing -- 2
Pikachuxss how to get cookie shooting range, always fail to return to the home page
Flomo software recommendation
笔记本电脑卡顿怎么办?教你一键重装系统让电脑“复活”
laravel 发送邮件
Norm normalization in tensorflow and pytorch of records
韩国或将禁止苹果和谷歌向开发者抽佣 创全球首例
Google 尝试在 Chrome 中使用 Rust
Ubuntu 20 installing centernet
DeNO 1.13.2 release
C, print the source program of beautiful bell triangle