Jump to content
Search Community

Scroll to open and close one by one

AndresBG test
Moderator Tag

Recommended Posts

Hey guys! how are you? I´m starting to learn GSAP and Scrolltrigger. I would like to know how can I create an interaction like the one I did in the codepen sample. The only difference that I dont understand is how to open only one box at a time and the others make collapse when they are out of the center of the viewport. Please can you help me with that? thanks in advance!

See the Pen wvPXEBM by andresbg (@andresbg) on CodePen

Link to comment
Share on other sites

Hi Andres,

 

That's sounds tricky, and probably not performant because your markers are getting out order, just like I mentioned here.

 

 

What's going to complicate it even further is that if a box above what's in the center collapses, it's going shift everything up, so what was in the center may not be in the center once it starts animating.

 

I would definitely suggest rethinking what you are trying to do here. Like maybe have all the animations in a single timeline and then scrub that. 🤷‍♂️

 

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