滚动计算

128 阅读1分钟
    //页面滚动加载分页
    $('.leftDataScrollAuto').off('scroll').on('scroll',function(){
        //获取当前加载更多按钮距离顶部的距离
        var bottomSubmit = $('.normalCaused').offset().top,
            nowTop = $(D).scrollTop()+$(W).height(); //获取当前页面底部距离顶部的高度距离
        //获取总页面数
        totalPageNum = $('#totalPage').val();
        //当当前页面的高度大于按钮的高度的时候开始触发加载更多数据
        if (nowTop > bottomSubmit) {
            //如果为真继续执行,这个是用于防止滚动获取过多的数据情况
            if (normalState === true) {
                //执行一次获取数据并停止再进来获取数据
                normalState = false;
                $('.normalCaused span').text('正在加载中.....');
               var timerD =  setTimeout(function () {
                   clearTimeout(timerD);
                    //当前页数++
                    nowPageNo++;
                    //记录当前为第二页
                    var options = {
                        pageNo: nowPageNo
                    }
                    CUST_WISH_TICKET.reloadPage(options);
                }, 500);
            }
        }
    });
var bottomSubmit = $('.normalCaused').offset().top,
            nowTop = $(D).scrollTop()+$(W).height(); //获取当前页面底部距离顶部的高度距离
           
 $aliBabaPairPageList.animate({'scrollTop': $('a[name="' + checkNames + '"]').offset().top + $aliBabaPairPageList.scrollTop() - $(window).scrollTop() - 100}, 500);
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-thumb {
    background-color: #dadada;
    border-radius: 4px;
}
::-webkit-scrollbar-track {
    background-color: transparent;
    border-radius: 4px;
}
vova:https://merchant-doc.vova.com.hk/#/