工作生活

js 下滑翻页兼容wap

2019-07-03  本文已影响0人  Chting
    $(window).scroll(function() {
        var htmlHeight = document.body.scrollHeight || document.documentElement.scrollHeight;
        // var clientHeight = document.documentElement.clientHeight; //window.screen.height 
        //pc可以用上面的,wap端为了兼容浏览器用下面的
        var clientHeight = window.screen.height; //window.screen.height
        var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
        if (parseInt(scrollTop + clientHeight + 1) >= htmlHeight) {
            page = typeof($('#page').val()) == 'undefined' ? 1 : $('#page').val();
            page == 1 ? page = 2 : '';
            preList(page);//这里面写翻页处理
        }
    });
上一篇 下一篇

猜你喜欢

热点阅读