我使用了演示 https://owlcarousel2.github.io/OwlCarousel2/demos/mousewheel.html 只更改了下面的代碼,因爲它會在該示例中進行反向滾動。設置OwlCarousel2的滾動速度
if (e.deltaY>0) {
owl.trigger('prev.owl');
} else {
owl.trigger('next.owl');
}
但它以非常大的速度滾動它。 如果每個舞臺使用6個項目 - 沒關係,但是如果你像每個舞臺一樣使用2或1個項目 - 它將滾動到數字10-11,而不是項目編號3或4.
我怎麼能使滾動速度變慢?一次滾動滾動2-3個項目?
我使用Safari瀏覽器,Mac OSX版塞拉利昂
全JS代碼:
var owl = jQuery('.owl-carousel');
owl.owlCarousel({
loop:false,
// stagePadding: 100,
slideBy:1,
nav:true,
margin:0,
responsiveClass:true,
responsive:{
0:{items:1},
600:{items:2,slideBy:2},
1024:{items:2,slideBy:2},
1366:{items:3,slideBy:3},
1920:{items:4,slideBy:4}
}
});
jQuery(".owl-prev").html('');
jQuery(".owl-next").html('');
owl.on('mousewheel', '.owl-stage', function (e) {
if (e.deltaY>0) {
owl.trigger('prev.owl.carousel', [1000]);
} else {
owl.trigger('next.owl.carousel', [1000]);
}
e.preventDefault();
});
明白我想要什麼 - 嘗試調整窗口大小到最小(每個舞臺一張幻燈片)並嘗試用鼠標滾輪滾動貓頭鷹傳送帶 https://owlcarousel2.github.io/OwlCarousel2/demos/mousewheel.html 您無法通過1張幻燈片或2進行滾動 - 它一次滾動7-11張幻燈片,它不會在幻燈片2或3上停止。 – illuzii