日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

JavaScript手機(jī)端頁面滑動(dòng)到底部加載信息(移動(dòng)端ajax分頁)

 aaie_ 2016-08-25

//獲取窗口可視范圍的高度
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;   
}
//滾動(dòng)加載
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)頁正文全文寬,包括有滾動(dòng)條時(shí)的未見區(qū)域

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

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

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

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)前窗口文檔對(duì)象寬度

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

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

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多