?? 瀏覽器高度和寬度js.txt
字號:
//取得瀏覽大小JS的類,兼容多種瀏覽器
//屬性
//.width 寬度
//.height 高度
//.scrollWidth 帶滾動條的寬度
//.scrollHeight 帶滾動條的高度
//.scrollTop 內容高度
function browserInfo(){
if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight || document.documentElement.scrollTop)){
this.width = document.documentElement.clientWidth;
this.height = document.documentElement.clientHeight;
this.scrollTop = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
this.scrollWidth = document.documentElement.scrollWidth;
this.scrollHeight = document.documentElement.scrollHeight > document.documentElement.clientHeight ? document.documentElement.scrollHeight : document.documentElement.clientHeight;
} else if(document.body && (document.body.clientWidth || document.body.clientHeight || document.body.scrollTop)){
this.width = document.body.clientWidth;
this.height = document.body.clientHeight;
this.scrollTop = document.body.scrollTop;
this.scrollWidth = document.body.scrollWidth;
this.scrollHeight = document.body.scrollHeight > document.body.clientHeight ? document.body.scrollHeight : document.body.clientHeight;
} else {
this.width = 0;
this.height = 0;
this.scrollTop = 0;
this.scrollWidth = 0;
this.scrollHeight = 0;
}
if(typeof(window.innerWidth) == 'number' || typeof(window.innerHeight ) == 'number' ){
this.width = window.innerWidth > this.width ? window.innerWidth : this.width;
this.height = this.hieght ? this.height : window.innerHeight;
this.scrollWidth = window.innerWidth > this.scrollWidth ? window.innerWidth : this.scrollWidth;
this.scrollHeight = this.scrollHeight > window.innerHeight ? this.scrollHeight : window.innerHeight;
}
if(document.body && document.body.clientWidth){
this.scrollWidth = this.scrollWidth > document.body.scrollWidth ? this.scrollWidth : document.body.scrollWidth;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -