Jump to content
Search Community

Use ScrollTrigger scrub to affect onEnter callback function

cotton
Moderator Tag

Go to solution Solved by SteveS,

Recommended Posts

Posted

Hello

 

I'm trying to change the background colour of an element (site_wrapper) based on the data-attr of another element (section) that is scrolling.

I've got it all working but would like to have the scrub affect the colour change rather than just animating the change onEnter.

 

Any pointers would be much appreciated.

 

 

See the Pen KKoJVaL by Cottonltd (@Cottonltd) on CodePen.

  • Solution
Posted

@cotton You will want to do it similar to this:

 

See the Pen KKoJMpZ by StevenStavrakis (@StevenStavrakis) on CodePen.

 

However, you probably need to adjust the start and end values to get deeper colors / colors at the right time.

  • Like 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...