<!--滚动条到达底部时自动跳转到第二页-->
<script language="javascript">
     $(document).ready(function (){
       var nScrollHight = 0; //滚动距离总长(注意不是滚动条的长度)
       var nScrollTop = 0;   //滚动到的当前位置
       var nDivHight = $(".page").height();
       $(".page").scroll(function(){
         nScrollHight = $(this)[0].scrollHeight;
         nScrollTop = $(this)[0].scrollTop;
     var paddingBottom = parseInt( $(this).css('padding-bottom') ),paddingTop = parseInt( $(this).css('padding-top') );
         if(nScrollTop + paddingBottom + paddingTop + nDivHight >= nScrollHight)
           alert("滚动条到底部了");
         });
     });
</script>
Last modification:April 19th, 2020 at 06:26 pm
如果觉得我的文章对你有用,请随意赞赏