『葉狂人』的怕失憶筆記 Front-End

好用的 document window 屬性

好用的 document window

在此記錄一下

$(window).resize(function() {
function getInfo() {
var s = "";
s += " 網頁可見區域寬:"+document.body.clientWidth;
s += "\r\n 網頁可見區域高:"+document.body.clientHeight;
s += "\r\n 網頁可見區域寬:"+ document.body.offsetWidth+ " (包括邊線和捲軸的寬)";
s += "\r\n 網頁可見區域高:"+document.body.offsetHeight + " (包括邊線的寬)";
s += "\r\n 網頁正文全文寬:"+document.body.scrollWidth;
s += "\r\n 網頁正文全文高:"+document.body.scrollHeight;
s += "\r\n 網頁被捲去的高(ff):"+ document.body.scrollTop;
s += "\r\n 網頁被捲去的高(ie):"+ document.documentElement.scrollTop;
s += "\r\n 網頁被捲去的左:"+document.body.scrollLeft;
s += "\r\n 網頁正文部分上:"+window.screenTop;
s += "\r\n 網頁正文部分左:"+window.screenLeft;
s += "\r\n 螢幕解析度的高:"+window.screen.height;
s += "\r\n 螢幕解析度的寬:"+window.screen.width;
s += "\r\n 螢幕可用工作區高度:"+window.screen.availHeight;
s += "\r\n 螢幕可用工作區寬度:"+window.screen.availWidth;
s += "\r\n 你的螢幕設置是 "+window.screen.colorDepth +" 位元彩色";
s += "\r\n 你的螢幕設置 "+window.screen.deviceXDPI +" 圖元/英寸";
alert (s);
}
getInfo();
});
『葉狂人』的怕失憶筆記, author
「自己做錯要自己解決,要勇敢面對。」
康師傅控股有限公司董事長 魏應州