react-reveal icon indicating copy to clipboard operation
react-reveal copied to clipboard

Prevent animation on reload, or when scrolling in different direction?

Open Jrayp opened this issue 7 years ago • 2 comments

This is probably related to the other issue:

Say your app fades in its elements (from bottom) as you scroll down. This is great. However, if the user reloads the page, then scrolls up, the elements will still fade in from the bottom, which looks very wonky. Is there a (clean) way to prevent this fade in after reload, or on scroll up?

Jrayp avatar Oct 05 '18 20:10 Jrayp

Maybe you could add a when (https://www.react-reveal.com/docs/when/) prop to the component, and keep the direction of the scrolling on that prop with a eventListener: window.addEventListener('scroll', this.handleScroll);

So if the user is scrolling down, set the prop as true.

GiuMagnani avatar Oct 16 '18 22:10 GiuMagnani

Maybe you could add a when (https://www.react-reveal.com/docs/when/) prop to the component, and keep the direction of the scrolling on that prop with a eventListener: window.addEventListener('scroll', this.handleScroll);

So if the user is scrolling down, set the prop as true.

Oh I somehow (stupidly) missed that bit of documentation. Thanks, I'll give it a try

Jrayp avatar Oct 16 '18 22:10 Jrayp