// 监听滚动事件
jQuery(function () {
jQuery("#r-list").scroll(function () {
//是否加载完成
if (isLoad) {
return false;
}
var divHeight = $(this).height();
var nScrollHeight = $(this)[0].scrollHeight;
var nScrollTop = $(this)[0].scrollTop;
//是否到达底部
if (nScrollTop + divHeight >= nScrollHeight) {
if (!isLoad) {
//显示加载更多的图标
jQuery(".loadmore").show();
//请求数据并显示
showList();
}
}
});
});
html:
<div class="easyui-navpanel" id="r-list">
<header>
<div class="m-toolbar">
<span class="m-title">列表</span>
</div>
</header>
<ul id="wj_list" class="m-list">
</ul>
<div align="center" class="loadmore">
<img style="width: 25px;" src="img/loading.gif" />
</div>
<div class="title" id="all-tip">已加载全部数据</div>
<div class="title error-tip">加载失败,请重试</div>
</div>

1251

被折叠的 条评论
为什么被折叠?



