小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

JavaScript手機端頁面滑動到底部加載信息(移動端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;   
}
//滾動加載
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ǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多