嘿,我正在使用swipper js构建垂直滑块!
目标解决方案:
->构建滑块时,我想在到达第一张或最后一张幻灯片后立即释放鼠标滚动。
问题:
->有时,当我将swiper版本降低到 4.5.1 时,它会使页面同时滚动和滑动(仅发生了几次) ->当我使用版本 5.3.1 时发生了主要问题,当到达第一张或最后一张幻灯片时,它突然滚动,并且过渡不顺畅,从而导致了一些可用性问题...
<script src="https://unpkg.com/swiper@5.3.1/js/swiper.min.js"></script>
代码:
版本4.5.1
let productSwiper = new Swiper(".swiper-container--product", {
direction: "vertical",
loop: false,
pagination: {
el: '.swiper-pagination',
clickable: true,
},
grabCursor: true,
speed: 1000,
paginationClickable: true,
parallax: true,
autoplay: false,
effect: "slide",
centerMode: false,
mousewheel: true,
loopFillGroupWithBlank: false,
slidesPerView: 'auto',
touchReleaseOnEdges:true
});
productSwiper.swiper;
版本5.3.1
let productSwiper = new Swiper(".swiper-container--product", {
direction: "vertical",
loop: true,
pagination: {
el: '.swiper-pagination',
clickable: true,
},
grabCursor: true,
speed: 1000,
parallax: true,
autoplay: false,
effect: "slide",
centerMode: false,
mousewheelSensitivity: 1,
mousewheel: {
releaseOnEdges: true,
},
loopFillGroupWithBlank: false,
slidesPerView: 'auto',
注意:我删除了4.5.1版本的Edge发行版,因为当前是引起该错误的原因。
很长的帖子,对不起,谢谢!