zoukankan      html  css  js  c++  java
  • 移动端上滑加载更多

    https://blog.csdn.net/helloxiaoliang/article/details/51492250

    $(window).scroll(function () {
         //已经滚动到上面的页面高度
        var scrollTop = $(this).scrollTop();
         //页面高度
        var scrollHeight = $(document).height();
          //浏览器窗口高度
        var windowHeight = $(this).height();
         //此处是滚动条到底部时候触发的事件,在这里写要加载的数据,或者是拉动滚动条的操作
         if (scrollTop + windowHeight == scrollHeight) {
                console.log(scrollTop);                     dragThis.insertDom();       } });

    https://blog.csdn.net/qq_37415950/article/details/80625391

    <script >
        /*第一种*/
        $(function(){
     
            $(window).scroll(function(){
     
                var scrollH = document.documentElement.scrollHeight;
     
                var clientH = document.documentElement.clientHeight;
                if (scrollH == (document.documentElement.scrollTop | document.body.scrollTop) + clientH){
                    //加载新数据
     
                    alert("加载新数据");
     
                }
            });
     
        });
        /*第二中 */
        //获取当前浏览器中的滚动事件
        $(window).off("scroll").on("scroll", function () {
     
            var scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight; //获取当前浏览器的滚动条高度
     
            if (scrollHeight <= ($(window).scrollTop() + $(window).height())) { //判断当前浏览器滚动条高度是否已到达浏览器底部,如果到达底部加载下一页数据信息
                $("#loadingImg").css('visibility','visible');
                setTimeout(function () {
     
                   
                    //模拟ajax
                    for(m=0;m<5;m++){
                        $(".order-list").append(appendStr);
                    }
                    
                },1000)
            }
        });
     
    </script>
  • 相关阅读:
    职业生涯起步不要去顶级公司
    discuz uc密码修改
    习惯决定成功与否
    世上没有理想的工作
    中山市慧海人力资源服务有限公司
    Codeforces Round #365 (Div. 2) B 前缀和
    Codeforces Round #365 (Div. 2) A 水
    tyvj 1067 dp 两次LIS(nlogn)
    Codeforces Round #303 (Div. 2) D 贪心
    Codeforces Round #303 (Div. 2) C dp 贪心
  • 原文地址:https://www.cnblogs.com/gavinyyb/p/9986833.html
Copyright © 2011-2022 走看看