问题描述
在手机苹果端的微信里,双击屏幕滑动模块会上移,并且不会恢复正常状态。
双击后,出现图下情况,不知道是我配置的问题,还是swiper.js没有处理这个bug,
麻烦大神指点一下。
Swiper的配置代码
var mySwiper = new Swiper (".swiper-container", {
direction: 'vertical',
mousewheelControl : true,
height : window.innerHeight,
// 如果需要前进后退按钮
nextButton: '.swiper-next',
simulateTouch : false,
onInit: function(swiper){ //Swiper2.x的初始化是onFirstInit
swiperAnimateCache(swiper); //隐藏动画元素
swiperAnimate(swiper); //初始化完成开始动画
},
onSlideChangeEnd: function(swiper){
swiperAnimate(swiper); //每个slide切换结束时也运行当前slide动画
if(swiper.isEnd){
swiper.nextButton[0].style.display='none';
}else{
swiper.nextButton[0].style.display='block';
};
},
});
var bbi = document.querySelector('.swiper-next');
document.body.ondblclick = function(){
bbi.click();
alert("lhi");
}
这个不是swiper的问题哦,我也刚遇到过了。
是因为html5页面嵌入到ios中的问题,在安卓中没有这个问题。
解决方案就是 将双击事件给阻止掉,监听用户是否是双击了,然后将第二次的点击事件给阻止掉,
代码如下: