成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

jquery獲取瀏覽器高度,獲取當前瀏覽器高度

jquery—獲取元素高度方法 (總結(jié))

$("#div_id").height();

讓客戶滿意是我們工作的目標,不斷超越客戶的期望值來自于我們對這個行業(yè)的熱愛。我們立志把好的技術(shù)通過有效、簡單的方式提供給客戶,將通過不懈努力成為客戶在信息化領(lǐng)域值得信任、有價值的長期合作伙伴,公司提供的服務(wù)項目有:域名注冊、網(wǎng)頁空間、營銷軟件、網(wǎng)站建設(shè)、輪臺網(wǎng)站維護、網(wǎng)站推廣。

// 獲得的是該div本身的高度, (不包含padding,margin,border)

$("#div_id").outerHeight();

// 包含該div本身的高度, padding上下的高度, 以及border上下的高度(不包含margin的高度)

$("#div_id").outerHeight(true);

// 包含該div本身的高度, 以及padding,border,margin上下的總高度

$(window).height();

// 獲取瀏覽器顯示區(qū)域(可視區(qū)域)的高度

$(window).width();

// 獲取頁面的文檔高度

$(document).height();

// 瀏覽器當前窗口文檔的高度

$(document.body).width();

// 瀏覽器當前窗口文檔body的高度

$(document).scrollTop();

// 獲取滾動條到頂部的垂直高度 (即網(wǎng)頁被卷上去的高度)

obj.offset().top

// 某個元素的上邊界到body最頂部的距離(在元素的包含元素不含滾動條的情況下)

jquery js如何獲取移動設(shè)備瀏覽器高度?

獲取代碼如下:

script

var w=document.documentElement?document.documentElement.clientHeight:document.body.clientHeight;

alert(w);

/script

獲取瀏覽器的高度:jquery代碼直接使用 $(window).height()。

獲取瀏覽器的寬度:

jquery代碼直接使用 $(window).With();

原生態(tài)JS代碼:

var w=document.documentElement?document.documentElement.clientWidth:document.body.clientWidth。

jquery怎么獲取瀏覽器高度

獲取瀏覽器的高度要有點計算,如下:

alert($(window).height());?//瀏覽器當前窗口可視區(qū)域高度?

alert($(document).height());?//瀏覽器當前窗口文檔的高度?

alert($(document.body).height());//瀏覽器當前窗口文檔body的高度?

alert($(document.body).outerHeight(true));//瀏覽器當前窗口文檔body的總高度?包括border?padding?margin?

alert($(window).width());?//瀏覽器當前窗口可視區(qū)域?qū)挾?

alert($(document).width());//瀏覽器當前窗口文檔對象寬度?

alert($(document.body).width());//瀏覽器當前窗口文檔body的高度?

alert($(document.body).outerWidth(true));//瀏覽器當前窗口文檔body的總寬度?包括border?padding?margin?

//?獲取頁面的高度、寬度

function?getPageSize()?{

var?xScroll,?yScroll;

if?(window.innerHeight??window.scrollMaxY)?{

xScroll?=?window.innerWidth?+?window.scrollMaxX;

yScroll?=?window.innerHeight?+?window.scrollMaxY;

}?else?{

if?(document.body.scrollHeight??document.body.offsetHeight)?{?//?all?but?Explorer?Mac????

xScroll?=?document.body.scrollWidth;

yScroll?=?document.body.scrollHeight;

}?else?{?//?Explorer?Mac...would?also?work?in?Explorer?6?Strict,?Mozilla?and?Safari????

xScroll?=?document.body.offsetWidth;

yScroll?=?document.body.offsetHeight;

}

}

var?windowWidth,?windowHeight;

if?(self.innerHeight)?{?//?all?except?Explorer????

if?(document.documentElement.clientWidth)?{

windowWidth?=?document.documentElement.clientWidth;

}?else?{

windowWidth?=?self.innerWidth;

}

windowHeight?=?self.innerHeight;

}?else?{

if?(document.documentElement??document.documentElement.clientHeight)?{?//?Explorer?6?Strict?Mode????

windowWidth?=?document.documentElement.clientWidth;

windowHeight?=?document.documentElement.clientHeight;

}?else?{

if?(document.body)?{?//?other?Explorers????

windowWidth?=?document.body.clientWidth;

windowHeight?=?document.body.clientHeight;

}

}

}???????

//?for?small?pages?with?total?height?less?then?height?of?the?viewport????

if?(yScroll??windowHeight)?{

pageHeight?=?windowHeight;

}?else?{

pageHeight?=?yScroll;

}????

//?for?small?pages?with?total?width?less?then?width?of?the?viewport????

if?(xScroll??windowWidth)?{

pageWidth?=?xScroll;

}?else?{

pageWidth?=?windowWidth;

}

arrayPageSize?=?new?Array(pageWidth,?pageHeight,?windowWidth,?windowHeight);

return?arrayPageSize;

}

//?滾動條

document.body.scrollTop;

$(document).scrollTop();

網(wǎng)站名稱:jquery獲取瀏覽器高度,獲取當前瀏覽器高度
標題來源:http://jinyejixie.com/article26/dsedjjg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供App設(shè)計、營銷型網(wǎng)站建設(shè)、ChatGPT、小程序開發(fā)、網(wǎng)站建設(shè)服務(wù)器托管

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站制作
郸城县| 三明市| 临汾市| 兰溪市| 锦屏县| 澜沧| 当阳市| 荆州市| 靖江市| 花莲县| 博爱县| 永寿县| 台州市| 侯马市| 铁岭县| 水城县| 呼伦贝尔市| 无为县| 英吉沙县| 涞水县| 灵宝市| 宜章县| 赞皇县| 安吉县| 台安县| 游戏| 中西区| 中西区| 清流县| 钦州市| 高清| 洱源县| 凤城市| 海阳市| 香河县| 丰镇市| 正安县| 长顺县| 饶阳县| 区。| 黑河市|