Swiper.js 轮播如何用鼠标中键同时控制多个轮播

Swiper.js Carousel How to control multiple carousel with middle mouse at the same time

我在屏幕上有 5 个旋转木马,它们都由相同的导航控制 buttons.I 还需要用鼠标中键滚动来控制它们。当我激活鼠标滚轮控制时,只有鼠标位于顶部的旋转木马在滚动时移动。我要把它们都搬走。

不知道有没有更好的解决办法,我就是这样解决的

// Wheel Control on Carousels

$( '#body' ).on( 'mousewheel', function ( event ) {
  if ( typeof event.originalEvent.wheelDeltaY === 'undefined' ) {
  console.log( "could not find mouse deltas" )
}
var deltaY = event.originalEvent.wheelDeltaY;
var scrolledUp = deltaY < 0;
var scrolledDown = deltaY > 0;
if ( scrolledUp ) {
  if (swiper_color.activeIndex > 2) {
goTop();
  }else{
  swiper_color.slidePrev();
  swiper_image.slidePrev();
  swiper_desc.slidePrev();
  swiper_title.slidePrev();
  swiper_jar.slidePrev();
  }
  }
  if ( scrolledDown ) {
if (swiper_color.activeIndex < 2) {
  swiper_color.slideNext();
  swiper_image.slideNext();
  swiper_desc.slideNext();
  swiper_title.slideNext();
  swiper_jar.slideNext();
}else{
  checkscroll();
}
   }
});