Iscroll 5在新版浏览器下会出现Unable to preventDefault inside passive event listener due to target being treated as passive错误.根据网上查的资料需要添加{ passive: false }
下面我们在Iscroll.js找到代码
me.addEvent = function (el, type, fn, capture) {
el.addEventListener(type, fn, !!capture);
};
改成下面这样
me.addEvent = function (el, type, fn, capture) {
if (type == "touchmove") {
el.addEventListener("touchmove", fn, { passive: false })
}
else if (type == "touchstart") {
el.addEventListener("touchstart", fn, { passive: false })
}
else {
el.addEventListener(type, fn, !!capture);
}
};