swiper内容超出纵向滚动

打包报错

使用swiper 4.x,webpack打包出错

1
2
js/dist/app.js from UglifyJs
Unexpected token: name (Dom7) [./node_modules/dom7/dist/dom7.modular.js:14,0][js/dist/app.js:24688,6]

最后使用swiper 3.4.2解决

超出内容滚动

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
this.swiper = new Swiper('#swiper', {
direction: 'vertical'
})
var startScroll, touchStart, touchCurrent;
this.swiper.slides.on('touchstart', function (e) {
startScroll = this.scrollTop;
touchStart = e.targetTouches[0].pageY;
}, true);
this.swiper.slides.on('touchmove', function (e) {
if (startScroll > 0 && startScroll < this.scrollHeight - this.offsetHeight) {
e.stopPropagation();
}
touchCurrent = e.targetTouches[0].pageY;
var touchesDiff = touchCurrent - touchStart;
var slide = this;
var onlyScrolling =
(slide.scrollHeight > slide.offsetHeight) && // allow only when slide is scrollable
(
(touchesDiff < 0 && startScroll === 0) || // start from top edge to scroll bottom
(touchesDiff > 0 && startScroll === (slide.scrollHeight - slide.offsetHeight)) || // start from bottom edge to scroll top
(startScroll > 0 && startScroll < (slide.scrollHeight - slide.offsetHeight)) // start from the middle
);
if (onlyScrolling) {
e.stopPropagation();
}
}, true);

答案出处

Unexpected token: name (Dom7)
超出内容滚动

如果觉得对您有帮助,请我喝杯咖啡可好☕️
Disqus 加载中...

如果长时间无法加载,请针对 disq.us | disquscdn.com | disqus.com 启用代理