精品伊人久久大香线蕉,开心久久婷婷综合中文字幕,杏田冲梨,人妻无码aⅴ不卡中文字幕

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
JavaScript手機端頁面滑動到底部加載信息(移動端ajax分頁)

//獲取窗口可視范圍的高度
function getClientHeight(){   
    var clientHeight=0;   
    if(document.body.clientHeight&&document.documentElement.clientHeight){   
         clientHeight=(document.body.clientHeight<document.documentElement.clientHeight)?document.body.clientHeight:document.documentElement.clientHeight;           
    }else{   
         clientHeight=(document.body.clientHeight>document.documentElement.clientHeight)?document.body.clientHeight:document.documentElement.clientHeight;       
    }   
    return clientHeight;   
}

function getScrollTop(){   
    var scrollTop=0;   
    scrollTop=(document.body.scrollTop>document.documentElement.scrollTop)?document.body.scrollTop:document.documentElement.scrollTop;           
    return scrollTop;   
}
//滾動加載
function scrollLoad(){
    //可視窗口的高度
    var scrollTop = 0;
    var scrollBottom = 0;
    $(document).scroll(function(){
        var dch = getClientHeight();
        scrollTop = getScrollTop();
          scrollBottom = document.body.scrollHeight - scrollTop;
          if(scrollBottom >= dch && scrollBottom <= (dch+10)){              
              if(pageCount == (currentPage+1)){
                      $(".click-load").hide();
                      return;
                  }              
                currentPage++;
                showList(currentPage,pageSize);                
            }
    });
}

 

 

順便寫一下常用的高度:

Javascript:

alert(document.body.clientWidth);        //網(wǎng)頁可見區(qū)域?qū)?body)

alert(document.body.clientHeight);       //網(wǎng)頁可見區(qū)域高(body)

alert(document.body.offsetWidth);       //網(wǎng)頁可見區(qū)域?qū)?body),包括border、margin等

alert(document.body.offsetHeight);      //網(wǎng)頁可見區(qū)域?qū)?body),包括border、margin等

alert(document.body.scrollWidth);        //網(wǎng)頁正文全文寬,包括有滾動條時的未見區(qū)域

alert(document.body.scrollHeight);       //網(wǎng)頁正文全文高,包括有滾動條時的未見區(qū)域

alert(document.body.scrollTop);           //網(wǎng)頁被卷去的Top(滾動條)

alert(document.body.scrollLeft);           //網(wǎng)頁被卷去的Left(滾動條)

alert(window.screenTop);                     //瀏覽器距離Top

alert(window.screenLeft);                     //瀏覽器距離Left

alert(window.screen.height);                //屏幕分辨率的高

alert(window.screen.width);                 //屏幕分辨率的寬

alert(window.screen.availHeight);          //屏幕可用工作區(qū)的高

alert(window.screen.availWidth);           //屏幕可用工作區(qū)的寬

 

Jquery

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

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

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

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

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

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

alert($(document.body).width());                //瀏覽器當(dāng)前窗口文檔body的寬度

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

本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
Js經(jīng)典實例收集
刷新頁面后返回到原來的頁面滾動位置
豬頭小隊長 | 浮動圖層問題解決終極版
js獲取瀏覽器高度和寬度值(多瀏覽器)
JavaScript Window
DIV始終居中的半透明彈出層
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服

主站蜘蛛池模板: 苍南县| 霍林郭勒市| 罗城| 平遥县| 兰西县| 上饶市| 和政县| 灵山县| 黄浦区| 保定市| 通山县| 商丘市| 宣武区| 唐河县| 革吉县| 桐柏县| 乃东县| 上犹县| 平安县| 嫩江县| 廉江市| 大关县| 外汇| 沭阳县| 东平县| 博罗县| 昌宁县| 吴旗县| 车险| 康保县| 宜章县| 东莞市| 太谷县| 金昌市| 惠东县| 漯河市| 靖边县| 府谷县| 富平县| 大名县| 曲靖市|