下拉到底部加载更多
var p=1;
active_list();function active_list() {$.ajax({type: "GET",url: "{:U('User/glodLogList_data')}",data: {page:p},dataType: "json",success: function(data){if(data==null){$("#add_more").html('沒有更多了');$("#add_more").removeAttr("onclick");}else{var str = '';for(i in data){str += '<tr>';str += '<td>'+data[i]['gtime']+'</td>';if(data[i]['glod']>0){str += '<td class="add">'+data[i]['glod']+'</td>';}else{str += '<td class="less">'+data[i]['glod']+'</td>';}str += '<td>'+data[i]['glod_info']+'</td>';str += '</tr>';}$("#table").append(str);p++;$("#add_more").html('加 載 更 多...');$("#add_more").attr("onclick","active_list()");}}});
}$(window).scroll(function(){var scrollTop = $(this).scrollTop();var scrollHeight = $(document).height();var windowHeight = $(this).height();if(scrollTop + windowHeight == scrollHeight){active_list();}
});
代碼供自己備用參考
轉載于:https://www.cnblogs.com/tingfengqieyu/p/5332041.html
總結
- 上一篇: Guava源码分析——Immutable
- 下一篇: 《FLUENT 14流场分析自学手册》—