判斷捲軸滑到底部觸發事件執行個體分享

來源:互聯網
上載者:User
本文主要為大家帶來一篇判斷捲軸滑到底部觸發事件的執行個體講解。具有很好的參考價值。一起跟隨小編過來看看吧,希望對大家有所協助,希望能協助到大家。

執行個體如下所示:

$(document).on("scroll", function () { //真實內容的高度 var pageHeight = Math.max(document.body.scrollHeight, document.body.offsetHeight); //視窗的高度 var viewportHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0; //隱藏的高度 var scrollHeight = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; //判斷載入視頻,文章,回答,醫生 if(pageHeight - viewportHeight - scrollHeight <=0){  //事件 }});
相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.