Reputation: 4828
I'm using swiper
i created this with some customization
The problem is that even if i scroll vertically, slider changes the slides.
How can i disable vertical scrolling either with CSS or JS and the package itself?
here is my code
<MySwiper
slidesPerView={3}
direction={"horizontal"}
freeMode={true}
style={{ overflow: "scroll", position: "relative" }}
spaceBetween={100}
mousewheel={true}
className="mySwiper"
>
<SwiperSlide>
<Slime></Slime>
</SwiperSlide>
</MySwiper>
Upvotes: 1
Views: 4809
Reputation: 4828
Add forceToAxis:true
to mousewheel
like so
mousewheel={{
forceToAxis: true,
}}
this makes swiper to ignore vertical scrolling.
Upvotes: 4