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; ...
随机推荐
- 关于索引degree设置的问题
--并行查询 可以使用并行查询的情况 1. Full table scans, full partition scans, and fast full index scans 2. Index ful ...
- 【HDOJ】1547 Bubble Shooter
两次BFS,一次扫描关联点.一次扫描可能掉落的情况(即再次扫描所有非爆炸的联通点).余下未被扫描的点均爆炸. #include <cstdio> #include <cstring& ...
- COJN 0487 800301红与黑
800301红与黑 难度级别:B: 运行时间限制:1000ms: 运行空间限制:51200KB: 代码长度限制:2000000B 试题描述 有一间长方形的房子,地上铺了红色.黑色两种颜色的正方形瓷砖. ...
- Xamarin Crack
Inspired by http://www.cnblogs.com/portal/p/4666252.html#undefined To 'crack' VS Xamarin, take VS201 ...
- Android新浪微博客户端(七)——ListView中的图片异步加载、缓存
原文出自:方杰|http://fangjie.info/?p=193转载请注明出处 最终效果演示:http://fangjie.sinaapp.com/?page_id=54 该项目代码已经放到git ...
- jQuery Ajax 实例 ($.ajax、$.post、$.get)【转载】
本文转载自:http://jun1986.iteye.com/blog/1399242 Jquery在异步提交方面封装的很好,直接用AJAX非常麻烦,Jquery大大简化了我们的操作,不用考虑浏览器的 ...
- [LeetCode] 310. Minimum Height Trees 解题思路
For a undirected graph with tree characteristics, we can choose any node as the root. The result gra ...
- 获取机器本地的公网ip地址
1. ipecho.net/plain
- xml中不能直接添加ViewGroup
我知道可以直接添加一个<View />的,今天想添加个容器类,然后后台动态添加SurfaceView到ViewGroup容器里,不过提示inflate报错了.难道ViewGroup不能直接 ...
- [转] 深入剖析 linux GCC 4.4 的 STL string
本文通过研究STL源码来剖析C++中标准模板块库std::string运行机理,重点研究了其中的引用计数和Copy-On-Write技术. 平台:x86_64-redhat-linux gcc ver ...