scrollHeight: 獲取對(duì)象的滾動(dòng)高度。
scrollLeft:設(shè)置或獲取位于對(duì)象左邊界和窗口中目前可見(jiàn)內(nèi)容的最左端之間的距離
scrollTop:設(shè)置或獲取位于對(duì)象最頂端和窗口中可見(jiàn)內(nèi)容的最頂端之間的距離
scrollWidth:獲取對(duì)象的滾動(dòng)寬度 內(nèi)容來(lái)自17jquery
內(nèi)容來(lái)自17jquery
offsetHeight:獲取對(duì)象相對(duì)于版面或由父坐標(biāo) offsetParent 屬性指定的父坐標(biāo)的高度
offsetLeft:獲取對(duì)象相對(duì)于版面或由 offsetParent 屬性指定的父坐標(biāo)的計(jì)算左側(cè)位置
offsetTop:獲取對(duì)象相對(duì)于版面或由 offsetTop 屬性指定的父坐標(biāo)的計(jì)算頂端位置
offsetWidth:是對(duì)象的可見(jiàn)寬度,包滾動(dòng)條等邊線(xiàn),會(huì)隨窗口的顯示大小改變
event.clientX 相對(duì)文檔的水平座標(biāo)
event.clientY 相對(duì)文檔的垂直座標(biāo)
一起jquery,17jquery
clientWidth:是對(duì)象可見(jiàn)的寬度,不包滾動(dòng)條等邊線(xiàn),會(huì)隨窗口的顯示大小改變。
clientHeight:都認(rèn)為是內(nèi)容可視區(qū)域的高度,也就是說(shuō)頁(yè)面瀏覽器中可以看到內(nèi)容的這個(gè)區(qū)域的高度,一般是最后一個(gè)工具條以下到狀態(tài)欄以上的這個(gè)區(qū)域,與頁(yè)面內(nèi)容無(wú)關(guān)。 內(nèi)容來(lái)自17jquery
event.offsetX 相對(duì)容器的水平坐標(biāo)
event.offsetY 相對(duì)容器的垂直坐標(biāo)
document.documentElement.scrollTop 垂直方向滾動(dòng)的值
event.clientX+document.documentElement.scrollTop 相對(duì)文檔的水平座標(biāo)+垂直方向滾動(dòng)的量 一起jquery,17jquery
以上主要指IE之中,F(xiàn)ireFox差異如下:
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均無(wú)關(guān)) 17jquery.com
17jquery.com
一起jquery,17jquery
測(cè)試:
內(nèi)容來(lái)自17jquery
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
</style>
</head>
<body>
<SCRIPT LANGUAGE="JavaScript">
var s = "";
s += "\r\n網(wǎng)頁(yè)可見(jiàn)區(qū)域?qū)挘?+ document.body.clientWidth;
s += "\r\n網(wǎng)頁(yè)可見(jiàn)區(qū)域高:"+ document.body.clientHeight;
s += "\r\n網(wǎng)頁(yè)可見(jiàn)區(qū)域?qū)挘?+ document.body.offsetWidth +" (包括邊線(xiàn)的寬)";
s += "\r\n網(wǎng)頁(yè)可見(jiàn)區(qū)域高:"+ document.body.offsetHeight +" (包括邊線(xiàn)的寬)";
s += "\r\n網(wǎng)頁(yè)正文全文寬:"+ document.body.scrollWidth;
s += "\r\n網(wǎng)頁(yè)正文全文高:"+ document.body.scrollHeight;
s += "\r\n網(wǎng)頁(yè)被卷去的高:"+ document.body.scrollTop;
s += "\r\n網(wǎng)頁(yè)被卷去的左:"+ document.body.scrollLeft;
s += "\r\n網(wǎng)頁(yè)正文部分上:"+ window.screenTop;
s += "\r\n網(wǎng)頁(yè)正文部分左:"+ window.screenLeft;
s += "\r\n屏幕分辨率的高:"+ window.screen.height;
s += "\r\n屏幕分辨率的寬:"+ window.screen.width;
聯(lián)系客服