• 手机页面分页加载更多


    Html

    <div class="load-more" id="load-more"><div class="loading"></div></div>

    JS

    var isLoading = false;
    var loadMoreTarget = $("#load-more");
    var listTarget = $("#list");
            
    listTarget.on("scroll", function(){
        var scrollTop = $(this).scrollTop();
        var height = $(this).height();
        var scrollHeight = $(this).get(0).scrollHeight;
        var h = scrollHeight - height - scrollTop;
        if(h < 100 && !isLoading){
            //loadMore();    
        }
    });

    CSS

    .load-more{
        height:50px;
        width: 100%;
    }
    
    .loading{
        overflow-y: auto;
        padding: 0px;
        height: 50px;
        width:40px;
        margin:0px auto;
        background: url(../images/loading.gif) no-repeat center 9px;
    }
  • 相关阅读:
    TS 3.1
    TS 3.1
    MDN 教程
    MDN 教程
    MDN 教程
    MDN 教程
    MDN 教程
    MDN 教程
    cookie会话技术
    数据库语法-1
  • 原文地址:https://www.cnblogs.com/rubekid/p/5438008.html
Copyright © 2020-2023  润新知