Disable wheel gestures when scroll next and previous are both false
hamidrezahanafi opened this issue · comments
Hello there and thanks for this great plugin!
Is there any way to disable wheel gestures when there are not enough slides to scroll? Right now when emblaApi.canScrollPrev()
and emblaApi.canScrollNext()
are false, I can still drag slides with wheel gestures and it snaps back into the place.
Best,
You would need to not pass the plugin in the plugins array in case u have less items.
const [emblaRef, embla] = useEmblaCarousel({ loop: false, skipSnaps: true },
items.length >= 3 ? [WheelGesturesPlugin()] : []
)
Hope that makes sense!
Thanks for the reply. Do you have any responsive solution for this?
This is going to change the ref when screen size changes, destroy carousel, reinit it and defy the use of breakpoints.