jq獲取頁面高度 JQuery獲取頁面高度寬度

2021-10-16 14:06:39 字數 819 閱讀 6093

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

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

function getpagesize() else else else else else else else {

pagewidth = windowwidth;

arraypagesize = new array(pagewidth, pageheight, windowwidth, windowheight);

return arraypagesize;

// 滾動條

document.body.scrolltop;

$(document).scrolltop();

vue獲渲染頁面後獲取內容高度

頁面使用了元件,渲染完之後獲取到的高度明顯不對,原來寫在mounted裡getheight 獲取不到。解決辦法 用 nexttick vue.nexttick callback,context 法一 在請求成功之後呼叫 this nexttick 我用了這種可以使用。法二 假如法一拿不到,就用wat...

jquery獲取當前頁面的高度

document scrolltop 獲取垂直滾動的距離 即當前滾動的地方的視窗頂端到整個頁面頂端的距離 document scrollleft 這是獲取水平滾動條的距離 要獲取頂端 只需要獲取到scrolltop 0的時候 就是頂端了 要獲取底端 只要獲取scrolltop document he...

jq 獲取當前螢幕高度

alert window height 瀏覽器時下視窗可視區域高度 alert document height 瀏覽器時下視窗文件的高度 alert document.body height 瀏覽器時下視窗文件body的高度 alert document.body outerheight true ...