jscottsmith / react-scroll-parallax

🔮 React hooks and components to create parallax scroll effects for banners, images or any other DOM elements.
https://react-scroll-parallax.damnthat.tv/
MIT License
2.9k stars 158 forks source link

Allow users to disable parallax from ParallaxProvider #183

Closed ArthurSangouard closed 1 year ago

ArthurSangouard commented 1 year ago

I'm looking to disable parallax on mobile, but it seems that the way to do this is to toggle the disabled prop in every instance of useParallax or Parallax. Letting users enable it from the root ParallaxProvider component would greatly simplify this.

jlarmstrongiv commented 1 year ago

That would also be helpful for accessibility for users who prefers-reduced-motion

jscottsmith commented 1 year ago

Yep this is a great idea. I'll look into it as soon as I can.

jscottsmith commented 1 year ago

Better late than never ;-)

Use the isDisabled prop.

<ParallaxProvider isDisabled>...</ParallaxProvider>

If there's any issues, let me know.