解决iscroll.js插件滚动区域无法拉动页面的问题!
在使用iscroll插件做滚动后,发现此区域无法拉动页面,尝试了很多方法 最终解决方法如下
//横向滚动列表
$('#hot,#hot1').each(function () {
var self = $(this),
length = self.find('li').length,
w = length * 2.45; //手机版一个li的宽度,我这里用的是rem
self.find('ul').width(w+"rem");
});
$('#hot,#hot1').each(function () {
var timeId;
new iScroll(this, {
hScroll: true,
onBeforeScrollStart: function (e) {
if ( this.absDistX > (this.absDistY + 5 ) ) {
// user is scrolling the x axis, so prevent the browsers' native scrolling
e.preventDefault();
}
},
onTouchEnd: function () {
var self = this;
if (self.touchEndTimeId) {
clearTimeout(self.touchEndTimeId);
}
self.touchEndTimeId = setTimeout(function () {
self.absDistX = 0;
self.absDistX = 0;
}, 600);
}
});
})

浙公网安备 33010602011771号