JQuery+Js 获取浏览器高度和宽度
JQuery-------做手机Web开发做浏览器兼容用到了,所以在网上找了些汇总下。 alert($(window).height()); //浏览器当前窗口可视区域高度
alert($(document).height()); //浏览器当前窗口文档的高度
alert($(document.body).height());//浏览器当前窗口文档body的高度
alert($(document.body).outerHeight(true));//浏览器当前窗口文档body的总高度 包括border padding margin
alert($(window).width()); //浏览器当前窗口可视区域宽度
alert($(document).width());//浏览器当前窗口文档对象宽度
alert($(document.body).width());//浏览器当前窗口文档body的高度
alert($(document.body).outerWidth(true));//浏览器当前窗口文档body的总宽度 包括border padding margin
-------------------------------------------------JS---------------------------------------------------------------
网页可见区域宽: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 HTML精确定位:scrollLeft,scrollWidth,clientWidth,offsetWidth**
scrollHeight: 获取对象的滚动高度。**
scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离**
scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离**
scrollWidth:获取对象的滚动宽度**
offsetHeight:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度**
offsetLeft:获取对象相对于版面或由 offsetParent 属性指定的父坐标的计算左侧位置**
offsetTop:获取对象相对于版面或由 offsetTop 属性指定的父坐标的计算顶端位置**
event.clientX 相对文档的水平座标**
event.clientY 相对文档的垂直座标**
event.offsetX 相对容器的水平坐标**
event.offsetY 相对容器的垂直坐标**
document.documentElement.scrollTop 垂直方向滚动的值**
event.clientX+document.documentElement.scrollTop 相对文档的水平座标+垂直方向滚动的量
IE,FireFox 差异如下:
IE6.0、FF1.06+:
clientWidth = width + padding
clientHeight = height + padding
offsetWidth = width + padding + border
offsetHeight = height + padding + border
IE5.0/5.5:**
clientWidth = width - border
clientHeight = height - border
offsetWidth = width
offsetHeight = height
(需要提一下:CSS中的margin属性,与clientWidth、offsetWidth、clientHeight、offsetHeight均无关)
JQuery+Js 获取浏览器高度和宽度的更多相关文章
- js获取浏览器高度和宽度值,尽量的考虑了多浏览器。
js获取浏览器高度和宽度值,尽量的考虑了多浏览器. IE中: document.body.clientWidth ==> BODY对象宽度 document.body.clientHeight ...
- 【转】js 获取浏览器高度和宽度值(多浏览器
原文地址:http://www.jb51.net/article/19844.htm js获取浏览器高度和宽度值,尽量的考虑了多浏览器. IE中: document.body.clientWidth ...
- js 获取浏览器高度和宽度值(多浏览器)(转)
IE中: document.body.clientWidth ==> BODY对象宽度 document.body.clientHeight ==> BODY对象高度 document.d ...
- 转:JS获取浏览器高度和宽度
发现一篇好文章,汇总到自己的网站上. IE中: document.body.clientWidth ==> BODY对象宽度 document.body.clientHeight ==> ...
- js 获取浏览器高度和宽度值(多浏览器)
IE中: document.body.clientWidth ==> BODY对象宽度 document.body.clientHeight ==> BODY对象高度 document.d ...
- 不同浏览器JS获取浏览器高度和宽度
摘自:http://blog.csdn.net/lai_gb/archive/2009/07/04/4320956.aspx IE中: document.body.clientWidth ==> ...
- JS获取浏览器高度和宽度
IE中: document.body.clientWidth ==> BODY对象宽度 document.body.clientHeight ==> BODY对象高度 document.d ...
- [转]js 获取浏览器高度和宽度值(多浏览器)(js获取宽度高度大全)
IE中: document.body.clientWidth ==> BODY对象宽度 document.body.clientHeight ==> BODY对象高度 document.d ...
- JS获取浏览器高度 并赋值给类
在给网站做轮播焦点图的时候,如果需要全屏的话,可以用下面的jQuery来获取浏览器高度,然后赋值给类. $(window).load(function () { var maxHeight = 0; ...
随机推荐
- hibernate和struts2实现分页功能
1.DAO层接口的设计,定义一个PersonDAO接口,里面声明了两个方法: public interface PersonDAO { public List<Person> queryB ...
- 未能找到类型或命名空间名称“XXXX”(是否缺少 using 指令或程序集引用?) 转
未能找到类型或命名空间名称“XXXX”(是否缺少 using 指令或程序集引用?) 项目中 App_Code 文件夹中的类的命名空间,在添加的页面的 using XXXX 时,提示 未能找到类 ...
- python摘抄
核心模块: random 当你的程序需要随机数功能时,random 模块就能派上用场.该模块包含多个伪随机数发生器,它们均以当前的时间戳为随机数种子.这样只要载入这个模块就能随时开始工作.下面列出了该 ...
- mysql 安装截图
这里有3个选项, 1.Developer Machine(开发机器),个人用桌面工作站,占用最少的系统资源 2.Server Machine(服务器),MySQL服务器可以同其它应用程序一起运行,例如 ...
- Types of AOP
There are two distinct types of AOP: static and dynamic. The difference between them is really the p ...
- shell中条件判断if中的-z到-d的意思【转载】
本文转载自[http://blog.csdn.net/utstarm/article/details/6536916] [ -a FILE ] 如果 FILE 存在则为真. [ -b FILE ] ...
- [LeetCode] 205. Isomorphic Strings 解题思路 - Java
Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the chara ...
- JavaScript中依赖注入详细解析
计算机编程的世界其实就是一个将简单的部分不断抽象,并将这些抽象组织起来的过程.JavaScript也不例外,在我们使用JavaScript编写应用时,我们是不是都会使用到别人编写的代码,例如一些著名的 ...
- W3C词汇和术语表
以A字母开头的词汇 英文 中文 abstract module 抽象模组 access 访问.存取 access control 存取控制 access control information 存取控 ...
- Jenkins错误“editable email notification aborted due to exception”的问题解决
如果出现:“editable email notification aborted due to exception”这样的错误,尝试升级一下jenkins,估计是这个导致的. 解决思路: http: ...