Jump to content
Search Community

Background change and div changing on scroll

Clou test
Moderator Tag

Go to solution Solved by Cassie,

Recommended Posts

Hi guys im kind of stuck here.  I want the background of the entire div to change (.animacija and .panel) with ease animation when the the user scroll to the last panel. I also have trouble to get clean animation with .panel changing... Of course the animation must work on back scroll

See the Pen YzJEOxY by matev-pevec (@matev-pevec) on CodePen

Link to comment
Share on other sites

Hi,

 

Just change this:

animacija.style.backgroundColor = "#F0F0F0";

To this:

gsap.to(animacija, { backgroundColor: "#F0F0F0", duration: 0.35 });

You can play with the duration and easing function (check the ease visualizer for more information).

 

Also is worth noticing that in your codepen example the leave back callback is never executed. I don't know if in your project it does.

 

Hopefully this helps.

Happy Tweening!

Link to comment
Share on other sites

Great, thank you. I cant figure out why the transition of the panels isnt smooth and why  i need  two las words (   <div class="panel zadnji">
            <h2>United</h2>
          </div>
          <div class="panel zadnji">
            <h2>United</h2>
          </div>) for the animation to work..

Link to comment
Share on other sites

Hi,

 

I've been looking at your codepen example and I can't figure exactly what is not working and how. I see all the text elements transitioning.

 

Please isolate your example to show just those elements and remove everything else. Same in your javascript code, just keep the code you need for those particular elements to animate.

 

Happy Tweening!

Link to comment
Share on other sites

Hi, i updated it, so the last panel is  must be writen 2 times in html.. i wanted to achive that the first panel (Creative) is visible from the start and the animation starts with second panel (Limitless), when the animation comes to the last panel (United), the background of all section includin panel must change to white

 

 

Link to comment
Share on other sites

Are you trying to do this?

 

See the Pen poxLvqY by GreenSock (@GreenSock) on CodePen



You have to have all your Content inside the ScrollSmoother wrapper and content div, you'll also need to target the correct trigger element and start position if you've added another panel in. Adding markers is always a good way to check where the triggers are.

 

Hope this helps.

  • Thanks 1
Link to comment
Share on other sites

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...