iscroll 的上拉刷新下拉加载 及卡顿的解决办法

function load() {
pullDown = $("#pullDown"),
loadingStep = 0; //加载状态0默认,1显示加载状态,2执行加载数据,只有当为0时才能再次加载,这是防止过快拉动刷新  


pullDown.hide();
myScroll = new IScroll("#wrapper", {
disableMouse: false,
disablePointer: false,
disableTouch: false,
scrollbars: false,
mouseWheel: false,
scrollX: false,
probeType: 2,
click: true,
bindToWrapper: true
});
myScroll.on("scroll", function() {
//console.log("scroll")
//pullDown.show();
if(loadingStep == 0 && !pullDown.attr("class").match('refresh|loading')) {
if(this.y > 40) { //下拉刷新操作  
pullDown.addClass("refresh").show();
loadingStep = 1;
myScroll.refresh();
}
}
});
myScroll.on("scrollEnd", function() {
if(loadingStep == 1) {
if(pullDown.attr("class").match("refresh")) { //下拉刷新操作  
pullDown.removeClass("refresh").addClass("loading");
loadingStep = 2;
liqu();
setTimeout(dataLoadEnded, 3000);
}
}
});


document.addEventListener('touchmove', function(e) {
e.preventDefault();
}, false);

}


解决卡顿问题


完美解决   不用复杂化 简单明了

你可能感兴趣的:(iscroll 的上拉刷新下拉加载 及卡顿的解决办法)