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

Parallax elements do not react to scroll #119

Closed kimmobrunfeldt closed 3 years ago

kimmobrunfeldt commented 3 years ago

I did everything according to the instructions: configure , tried all troubleshooting tips such as calling .update() after image load, or after page load or resize.

kimmobrunfeldt commented 3 years ago

The issue for me was that scrollContainer defaults to <body> but my div#react-root element had overflow-x: hidden attribute set, which caused the browser not to send any scroll events to react-scroll-parallax library.

The fix was to set scrollContainer={document.querySelector('#react-root')} instead of the default <body> element.

I opened the issue just if someone (me?) tries to troubleshoot their setup in the future.