maxmarinich / vanilla-swipe

Tiny vanilla JS module to detect swipe direction and trigger custom events accordingly.
MIT License
33 stars 5 forks source link

Disable vertical scroll only if scrolling horizontally #5

Closed develohpanda closed 4 years ago

develohpanda commented 4 years ago

Fixes #4

Preventing the event on touchMove should only happen when the swipe direction is horizontal, and it should not prevent if a vertical scroll is initiated on the carousel.

The current behavior prevents a vertical page scroll if the scroll is initiated from a carousel.

Happy to discuss this solution, however it's definitely a blocker for me using this across all of our projects. react-alice-carousel is really great!

😄

maxmarinich commented 4 years ago

closed as irrelevant

develohpanda commented 4 years ago

closed as irrelevant

Sorry about that, got bogged down with other things. I ended up going ahead with https://kenwheeler.github.io/slick/ as it contains the expected behavior.

felixmosh commented 1 year ago

@maxmarinich can we split the preventDefaultTouchmoveEvent into 2 separate props? One for preventDefaultTouchVerticalMoveEvent and one for preventDefaultTouchVerticalMoveEvent. This way, in alice-react-carousel, on mobile view, when the carousel is horizontal, it will prevent only the preventDefaultTouchVerticalMoveEvent

WDYT?