兼容IE8,滚动加载下一页

2023-06-12,,

// 滚动加载下一页
        var nowScrolledHeight = document.documentElement.scrollTop || document.body.scrollTop;
        var docHeight = document.body.clientHeight;
        if(window.innerHeight!= undefined){
            var pageHeight = window.innerHeight;
        } else{
            var B= document.body, D= document.documentElement;
            var pageHeight = Math.min(D.clientHeight, B.clientHeight);
        }
        var go = parseInt(docHeight) - parseInt(pageHeight + 20);
        console.log(nowScrolledHeight)
        console.log(docHeight)
        console.log(pageHeight)
        console.log(go)
        if (nowScrolledHeight >= go && hasNext) {
            console.log('滚动成功');
            pageIndex++;
            searchGoods(word, pageIndex, orderType);
            $(".data_loading").show();
            $(".data_lastpage").hide();
        } else if(!hasNext){
            $(".data_loading").hide();
            $(".data_lastpage").show();
        }

兼容IE8,滚动加载下一页的相关教程结束。

《兼容IE8,滚动加载下一页.doc》

下载本文的Word格式文档,以方便收藏与打印。