当前位置:网站首页>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();
})
边栏推荐
猜你喜欢

Leetcode刷题——对链表进行插入排序

【Day1】VMware软件安装

Configuration of TensorFlow ObjecDetectionAPI under Anaconda3 of win10 system

入门文档05 使用cb()指示当前任务已完成

Dsf5.0 bounced points determine not return a value

Unity物理引擎中的碰撞、角色控制器、Cloth组件(布料)、关节 Joint

每日一题-两数相加-0711

Unity中的GetEnumerator 方法及MoveNext、Reset方法
D45_摄像机组件Camera

硬核!Cocos开发面试必备十问,让你offer拿到手软
随机推荐
Spark源码-任务提交流程之-6-sparkContext初始化
Unity常用模块设计 : Unity游戏排行榜的制作与优化
URP渲染管线实战教程系列 之URP渲染管线实战解密(一)
Lua,ILRuntime, HybridCLR(wolong)/huatuo热更对比分析
Getting Started Document 07 Staged Output
每日一题-下一个排列-0723
入门文档03 区分开发与生产环境(生产环境才执行‘热更新’)
论那些给得出高薪的游戏公司底气到底在哪里?
新一代解析技术——云解析
Leetcode刷题——对链表进行插入排序
Contextual non-local alignment of full-scale representations
【Day6】文件系统权限管理 文件特殊权限 隐藏属性
Unity huatuo 革命性热更系列1.3 huatuo示例项目源码分析与启发
Hard Disk Partitioning and Permanent Mounting
huatuo 革命性热更新解决方案系列1·1 为什么这么NB?huatuo革命Unity热更新
云游戏未来展望
spark算子-wholeTextFiles算子
链表章6道easy总结(leetcode)
【Day8】Knowledge about disk and disk partition
Getting Started Documentation 12 webserve + Hot Updates