JQ-异步上划加载

 //加载事件
        var page = 2;
        var next = true;
        $(window).scroll(function(){
            var scrollH = document.documentElement.scrollHeight;
            var clientH = document.documentElement.clientHeight;
            if (scrollH == (document.documentElement.scrollTop | document.body.scrollTop) + clientH){
                if(next) {
                    next = false;
                    var index = layer.load(0,{shade: [0.3,'#000'] })
                    $.post('/portal/sign/verification/', {
                        page: page
                    }, function (res) {
                        layer.close(index)
                        page++;
                        var a = '';
                        var list = res.msg;
                        if (list.length > 0) {
                            for (var i = 0; i < list.length; i++) {
                                a='';
                                a += " <a class='ca-h' href='/portal/sign/verificationinfo/id/" + list[i].id + "'>";
                                a += " <div class='ca-i'><img src='" + list[i].avatar + "' alt='" + list[i].full_name + "' class='ca-j'></div>";
                                a += " <div class='ca-k'>";
                                a += " <div class='ca-l'>姓 名:" + list[i].full_name + "</div>";
                                a += " <div class='ca-l'>分类点:<span class='ca-m'>" + list[i].address + "</span>";
                                a += " </div> </div><div class='ca-n'>";
                                a += " <div class='ca-o ca-o1 sub'  data-id='" + list[i].id + "' data-status='1' >通过</div>";
                                a += " <div class='ca-o ca-o2 sub'  data-id='" + list[i].id + "' data-status='2' >不通过</div> </div>";
                                $('#appent').append(a)
                            }
                            next = true;
                        } else {
                            layer.msg('暂无更多记录')
                            a += " <div class='ca-h pagenum'>暂无更多记录</div> ";
                            $('#appent').append(a)
                        }

                    }, 'json')
                }
            }
        });

点赞
  1. zzp zzp说道:
    QQbrowser Windows 7

    还行 :huaji6:

    1. 博主 博主说道:
      Google Chrome Windows 10

      :huaji20:

发表评论