Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can i prevent vertical scroll on mobile? #747

Open
AllStarsAT opened this issue Sep 18, 2023 · 3 comments
Open

How can i prevent vertical scroll on mobile? #747

AllStarsAT opened this issue Sep 18, 2023 · 3 comments

Comments

@AllStarsAT
Copy link

AllStarsAT commented Sep 18, 2023

Am I doing something wrong or is this the behaviour that is expected?
I use the following Setup for my Carousel:

When using this Carousel on my Website, using a phone, if i want to swipe to the next picture, the whole website scrolls. I would expect, that if i scroll on the Carousel itself, that in my case vertical scrolling on the website does not work anymore and im kind of stuck with scrolling. Is there a way or a good workaournd to get this behaviour?

<Carousel
className={"imageCarousel"}
autoPlay={true}
axis={"horizontal"}
showArrows={true}
infiniteLoop={true}
interval={3000}
>
....

EDIT: maybe preventing the scrolling totally could lead to some breakings on a website, how about reducing the amount of vertical scrolling while scrolling on top of a carousel element?

@drillprop
Copy link

Am I doing something wrong or is this the behaviour that is expected? I use the following Setup for my Carousel:

When using this Carousel on my Website, using a phone, if i want to swipe to the next picture, the whole website scrolls. I would expect, that if i scroll on the Carousel itself, that in my case vertical scrolling on the website does not work anymore and im kind of stuck with scrolling. Is there a way or a good workaournd to get this behaviour?

<Carousel className={"imageCarousel"} autoPlay={true} axis={"horizontal"} showArrows={true} infiniteLoop={true} interval={3000} > ....

EDIT: maybe preventing the scrolling totally could lead to some breakings on a website, how about reducing the amount of vertical scrolling while scrolling on top of a carousel element?

I don't think there is any specific prop that could 100% prevent from doing this, but I used preventMovementUntilSwipeScrollTolerance and this setting helped. You can adjust also swipeScollTolerance

@KoolP
Copy link

KoolP commented Nov 29, 2023

Am I doing something wrong or is this the behaviour that is expected? I use the following Setup for my Carousel:
When using this Carousel on my Website, using a phone, if i want to swipe to the next picture, the whole website scrolls. I would expect, that if i scroll on the Carousel itself, that in my case vertical scrolling on the website does not work anymore and im kind of stuck with scrolling. Is there a way or a good workaournd to get this behaviour?
<Carousel className={"imageCarousel"} autoPlay={true} axis={"horizontal"} showArrows={true} infiniteLoop={true} interval={3000} > ....
EDIT: maybe preventing the scrolling totally could lead to some breakings on a website, how about reducing the amount of vertical scrolling while scrolling on top of a carousel element?

I don't think there is any specific prop that could 100% prevent from doing this, but I used preventMovementUntilSwipeScrollTolerance and this setting helped. You can adjust also swipeScollTolerance

That fixed for me, added them both and put swipeScrolltolerance to 30. We had a fullpage herobanner slider on web and mobile and now I am able to scroll vertically and horizontally the page on mobile.

@0nahid
Copy link

0nahid commented Feb 6, 2024

Am I doing something wrong or is this the behaviour that is expected? I use the following Setup for my Carousel:
When using this Carousel on my Website, using a phone, if i want to swipe to the next picture, the whole website scrolls. I would expect, that if i scroll on the Carousel itself, that in my case vertical scrolling on the website does not work anymore and im kind of stuck with scrolling. Is there a way or a good workaournd to get this behaviour?
<Carousel className={"imageCarousel"} autoPlay={true} axis={"horizontal"} showArrows={true} infiniteLoop={true} interval={3000} > ....
EDIT: maybe preventing the scrolling totally could lead to some breakings on a website, how about reducing the amount of vertical scrolling while scrolling on top of a carousel element?

I don't think there is any specific prop that could 100% prevent from doing this, but I used preventMovementUntilSwipeScrollTolerance and this setting helped. You can adjust also swipeScollTolerance

That fixed for me, added them both and put swipeScrolltolerance to 30. We had a fullpage herobanner slider on web and mobile and now I am able to scroll vertically and horizontally the page on mobile.

  preventMovementUntilSwipeScrollTolerance={true}
      swipeScrollTolerance={30}

Thanks buddy, this helps me to prevent on mobile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants