当前位置:网站首页>js动态获取屏幕宽高度
js动态获取屏幕宽高度
2022-08-05 05:19:00 【CrazyQiQi】
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实时获取屏幕宽高
// 原生js
window.οnlοad=function(){
changeDivHeight();
}
//当浏览器窗口大小改变时,设置显示内容的高度
window.οnresize=function(){
changeDivHeight();
}
function changeDivHeight(){
var h = document.documentElement.clientHeight;//获取页面可见高度
}
// jquery
$(window).resize(function(){
var Height = $(window).height();
var Width = $(window).width();
})
边栏推荐
- Getting Started 03 Distinguish between development and production environments ("hot update" is performed only in the production environment)
- 每日一题-三数之和-0716(2)
- 网络布线与数制转换
- ACL 和NAT
- 入门文档05 使用cb()指示当前任务已完成
- 入门文档11 自动添加版本号
- UiPath简介
- 【Machine Learning】1 Univariate Linear Regression
- 【Day6】文件系统权限管理 文件特殊权限 隐藏属性
- Hard Disk Partitioning and Permanent Mounting
猜你喜欢
随机推荐
腾讯云云函数SCF—入门须知
huatuo 革命性热更新解决方案系列1·1 为什么这么NB?huatuo革命Unity热更新
Hard Disk Partitioning and Permanent Mounting
Unity huatuo 革命性热更系列1.3 huatuo示例项目源码分析与启发
spark源码-任务提交流程之-2-YarnClusterApplication
UiPath简介
C语言的一些小常识
Getting Started 05 Using cb() to indicate that the current task is complete
Wireshark抓包及常用过滤方法
D39_向量
快问快答—腾讯云服务器常见问题解答
入门文档07 分阶段输出
单臂路由与三成交换机
每日一题-字典
Getting Started Doc 08 Conditional Plugins
网站ICP备案是什么呢?
栈区中越界可能造成的死循环可能
什么?CDN缓存加速只适用于加速静态内容?
ACL 和NAT
新一代解析技术——云解析









