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

Incorrect initial loading of values #142

Closed cireix closed 2 years ago

cireix commented 2 years ago

Initial values should be the same as what is inputted.

VSCode: image

Rendered: image

The rendered translateY value should be the same as the start value of translateY in the code.

jscottsmith commented 2 years ago

Are you able to provide a link to your site or a demo of the behavior? It would be helpful in determining the cause of this behavior.

I'll see if I can create a reproduction of this in a sandbox.

jscottsmith commented 2 years ago

Not sure how to reproduce this -- here's my attempt based on the setup you have, but everything looks normal to me.

cireix commented 2 years ago

Here's a playground to work with.

If you inspect the initial rendered page, you can see that the translateY value is inconsistent with what is coded. image

Thank you for helping.

jscottsmith commented 2 years ago

Thanks! that helps. I see the issue now and have an idea of what may be causing it. I will look into it and see if I can get a fix out soon.

jscottsmith commented 2 years ago

Published a fix in the dependency. You should be able to see the fix in v3.0.5. Example: https://nujwyi.csb.app/

Let me know if you have any trouble.

cireix commented 2 years ago

Thanks for the quick fix!