JQuery+Jsブラウザの高さと幅を取得
2231 ワード
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 )