Disable window scrolling while swiping horizontally [MOBILE]
See original GitHub issueWhen you start scrolling on mobile(Safari && Chrome from iOS) it is able to scroll vertically and thats bad UX. Is there any workarounds for that case.
My settings:
let settings = { className: this.props.className || '', infinite: true, lazyLoad: true, speed: 200, arrows: this.props.arrows, swipeToSlide: true, touchMove: true, nextArrow: <NextArrow/>, prevArrow: <PrevArrow/>, afterChange: this.props.afterChange, beforeChange: this.props.beforeChange, };
Issue Analytics
- State:
- Created 5 years ago
- Reactions:18
- Comments:22
Top Results From Across the Web
Disable vertical scrolling while swiping on touch device using ...
I want to disable vertical scrolling on webpage while swiping the carousel horizontally on mobile devices. I'm using the Owl carousel.
Read more >Prototype scrolling with overflow behavior - Figma Help Center
Horizontal scrolling allows users to swipe or scroll left and right within a frame, while maintaining their vertical position. Use this to create...
Read more >How To Create Horizontal Scrolling Containers - codeburst
On our container, we want to turn off vertical scrolling (overflow-y) and enable horizontal scrolling (overflow-x). Then with each card, we want to...
Read more >How To Fix Horizontal Scrollbar on Mobile When Using ...
The horizontal scrollbar issue on mobile devices can be fixed by setting overflow to hidden. You can do this by using the Elementor...
Read more >How To Prevent Scrolling The Page On iOS Safari 15 - PQINA
We set the height of both the html and the body element to the window height and then set overflow on these elements...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
How about this?
following the code by @yunyong I’ve come up with a solution that doesn’t break the window horizontal scroll by adding the
addEventListener
to a div containing the react-slick component instead of the window object.Also @iDVB I don’t think it’s a good idea to save the
firstClientX, firstClientY, clientX
into the state as this values do not affect the component render at all, furthermore, thesetX
calls are slower than just assigning the new values to normal variables defined outside the component given that thetouchstart
andtouchmove
are called about 10 times by one simple little scroll.