您的位置:首页 > 其它

swiper 内容超出纵向滚动 解决办法

2016-06-23 11:32 393 查看
.swiper-slide{ overflow:auto; }



varswiper=newSwiper('.swiper-container',{
direction:'vertical',autoHeight:true
});
varstartScroll,touchStart,touchCurrent;
swiper.slides.on('touchstart',function(e){
startScroll=this.scrollTop;
touchStart=e.targetTouches[0].pageY;
},true);
swiper.slides.on('touchmove',function(e){
touchCurrent=e.targetTouches[0].pageY;
vartouchesDiff=touchCurrent-touchStart;
varslide=this;
varonlyScrolling=
(slide.scrollHeight>slide.offsetHeight)&&//allowonlywhenslideisscrollable
(
(touchesDiff<0&&startScroll===0)||//startfromtopedgetoscrollbottom
(touchesDiff>0&&startScroll===(slide.scrollHeight-slide.offsetHeight))||//startfrombottomedgetoscrolltop
(startScroll>0&&startScroll<(slide.scrollHeight-slide.offsetHeight))//startfromthemiddle
);
if(onlyScrolling){
e.stopPropagation();
}
},true);


  来源:https://github.com/nolimits4web/Swiper/issues/1467


                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: