Stanko / react-plx

React parallax component, powerful and lightweight
https://muffinman.io/react-plx/
MIT License
687 stars 51 forks source link

Can we toggle a class when scrolling? #57

Closed dil25 closed 4 years ago

dil25 commented 4 years ago

Can we toggle the CSS class when scrolling (scroller event)?

Stanko commented 4 years ago

It is already supported: https://github.com/Stanko/react-plx#animation-state-css-classes

dil25 commented 4 years ago

Thanks for the reply..can we add our own css class when scrolling dynamically?

Stanko commented 4 years ago

Unfortunately not, adding custom class for every possible state feels a little bit over the top.

You can achieve everything using these, and I think the code is very readable:

Example:

.Header.Plx--active { }

.Header.Plx--in-0 { }

.Header.Plx--between-0-and-1 { }

.Header.Plx--below { }

And you can name your animation parts and those will be used instead of numbers.

Example:

.Plx--in-slideFromLeft { }

.Plx--between-slideFromLeft-and-fadeOut { }

.Plx--in-fadeOut { }