h5 页面下拉刷新
引入文件
<link rel="stylesheet" type="text/css" href="bin/minirefresh.css"/>
<!-- <link rel="stylesheet" type="text/css" href="bin/common.css"/> -->
<link rel="stylesheet" type="text/css" href="bin/minirefresh.theme.applet.css"/>
<script type="text/javascript" src="bin/minirefresh.js"></script>
<script type="text/javascript" src="bin/minirefresh.theme.applet.js"></script>
js:
// 引入任何一个主题后,都会有一个 MiniRefresh 全局变量
var miniRefresh = new MiniRefresh({
container: '#minirefresh',
down: {
callback: function() {
// 下拉事件
if(indexNav==0){
indexList(localStorage.getItem("userId"),"1");
}else{
indexList(localStorage.getItem("userId"),"2");
}
setTimeout(function(){
miniRefresh.endDownLoading();
},1000)
}
},
up: {
callback: function() {
// 上拉事件
// 注意,由于默认情况是开启满屏自动加载的,所以请求失败时,请务必endUpLoading(true),防止无限请求
miniRefresh.endUpLoading(true);
}
}
});
html:
<div id="minirefresh" class="minirefresh-wrap">
<div class="minirefresh-scroll"></div></div>