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

ParallaxBanner with scrollContainer only works with ref in state #110

Closed ghost closed 3 years ago

ghost commented 3 years ago

ParallaxBanner with a scrollContainer only works when you set the ref.current to the state and then pass the state variable to the scrollContainer prop.

Here an example: https://codesandbox.io/s/spring-butterfly-e5006?file=/src/App.js

jscottsmith commented 3 years ago

take a look at this, it may help: https://github.com/jscottsmith/react-scroll-parallax/blob/develop/stories/ScrollContainer.js