jquery使用iscorll实现上拉、下拉加载刷新-创新互联
本文实例为大家分享了iscorll实现上拉下拉加载刷新的具体代码,供大家参考,具体内容如下

实现原理是:判断fiiptop,flipdown是否显示为依据
myScroll = new iScroll('wraphome', {
fixedScrollbar: true,
hideScrollbar: true,
fadeScrollbar: true,
hScrollbar: false,
vScrollbar: true,
onScrollMove: function () {
var topstat = $(".fliptop").is(":visible");
var downstat = $(".flipdown").is(":visible");
if (this.y > 15 && !topstat && !downstat) {
$(".fliptop").fadeIn(300);
} else if (this.y < 15 && topstat) {
$(".fliptop").hide();
} else if (this.y < (this.maxScrollY - 25) && !topstat && !downstat) {
$(".flipdown").fadeIn(300);
this.refresh(); //这里是当显示正在加载中时刷新底部位置
} else if (this.y > (this.maxScrollY + 25) && downstat) {
$(".flipdown").hide();
}
},
onTouchEnd: function () {
var topstat = $(".fliptop").is(":visible");
var downstat = $(".flipdown").is(":visible");
if (topstat && !downstat) {
$(".fliptop").html("正在加载中……");
setTimeout(function(){
//此处为你自己的逻辑方法
},3000);
} else if (downstat && !topstat) {
$(".flipdown").html("正在加载中……");
setTimeout(function(){
//此处为你自己的逻辑方法
},3000);
}
}
});
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
网页标题:jquery使用iscorll实现上拉、下拉加载刷新-创新互联
URL标题:http://www.jxjierui.cn/article/coodde.html


咨询
建站咨询
