TA的每日心情 | 开心 2018-12-13 09:04 |
---|
签到天数: 3 天 [LV.2]偶尔看看I
新手上路
- 积分
- 37
|
var startScroll, touchStart, touchCurrent;
mySwiper.slides.on('touchstart', function (e) {
startScroll = this.scrollTop;
touchStart = e.targetTouches[0].pageY;
}, true);
mySwiper.slides.on('touchmove', function (e) {
touchCurrent = e.targetTouches[0].pageY;
var touchesDiff = touchCurrent - touchStart;
var slide = this;
var onlyScrolling =
(slide.scrollHeight > slide.offsetHeight) &&
(
(touchesDiff < 0 && startScroll === 0) ||
(touchesDiff > 0 && startScroll === (slide.scrollHeight - slide.offsetHeight)) ||
(startScroll > 0 && startScroll < (slide.scrollHeight - slide.offsetHeight))
);
if (onlyScrolling) {
e.stopPropagation();
}
}, true); |
|