美文网首页工作生活
js 下滑翻页兼容wap

js 下滑翻页兼容wap

作者: Chting | 来源:发表于2019-07-03 15:02 被阅读0次
    $(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);//这里面写翻页处理
        }
    });

相关文章

网友评论

    本文标题:js 下滑翻页兼容wap

    本文链接:https://www.haomeiwen.com/subject/mrnqhctx.html