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

Allow preventScroll to be a function? #32

Closed
brophdawg11 opened this issue Oct 12, 2020 · 0 comments · Fixed by #33
Closed

Allow preventScroll to be a function? #32

brophdawg11 opened this issue Oct 12, 2020 · 0 comments · Fixed by #33

Comments

@brophdawg11
Copy link
Contributor

I was wondering if you would be open to allowing a function to be passed in for preventScroll so the application could make a decision on whether to call preventDefault? I'm still playing around with it a bit, but the current use-case I have is a mobile e-commerce display where there' a main product image that can be swiped left/right to see different images. But setting preventScroll: true makes it such that the user can't scroll by "swiping" up and down on the image either. And when the image takes up most of the vertical real estate, it there's only small sections that the user can use to scroll the image out of the viewport.

I am experimenting locally with using the event details to control whether to preventDefault based on the delta between the x coordinates and y coordinates.

If so, I would be happy to push up a PR once I have something working.

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

Successfully merging a pull request may close this issue.

1 participant