获取当前屏幕的高度宽度(JQuery/网页特效)
Query获取浏览器窗口宽高,文档宽高
2010-01-20 08:59
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
实例
//js获取当前窗口的宽度高度。获取窗口尺寸
WE.getWndSize = function() {
var w = 0, h = 0;
if (window.innerWidth && window.innerHeight) {
w = window.innerWidth;
h = window.innerHeight;
} else if (document.documentElement) {
w = document.documentElement.clientWidth;
h = document.documentElement.clientHeight;
} else if (document.body.clientWidth && document.body.clientHeight) {
w = document.body.clientWidth;
h = document.body.clientHeight;
}
return { width: w, height: h };
}
from:
http://www.111cn.net/wy/js-ajax/39256.htm
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29896512/viewspace-1282082/
,如需转载,请注明出处,否则将追究法律责任。