Jump to content
Search Community
TrulyNewbie test
Moderator Tag

Recommended Posts

Hi, newbie here.

 

I'm desperately trying to figure out how to pin the second div to the top of the screen, beneath the first div, then releasing it as the div above it ends. Just like - https://jeongsteph.design/

 

I've tried toggleclass too but I just can't get it and I don't know where I'm going wrong. Please help me

 

Thank you

See the Pen ExPdJxK by NewbieRuby (@NewbieRuby) on CodePen

  • Thanks 1
Link to comment
Share on other sites

  • 4 months later...

Hi, I'm new to gsap and coding in general, but I'm so psyched about the intuitivness and power of your product. 

This was exactly what I was looking for as well, however I was wondering if it possible to control the z-index of each section. So that the red section would appear on top of the blue, but the orange would appear from underneath the red. Is that possible?

Best regards,

 

Link to comment
Share on other sites

I'm trying to wrap my head around what you expect to happen with your code. It's doing exactly what you asked, but are you saying that you want to control the ORDER that each panel comes in by altering the zIndex? That's not really how that works. If you want to control the order, simply put the divs in that order in the DOM. 

 

What are you hoping will happen by changing those zIndex values in the way you did?

  • Like 1
Link to comment
Share on other sites

  • 3 years later...

@alendra welcome to the forums.

 

It's usually best to create a new thread instead of hijacking one that's 3 years old. I imagine you might be looking for something like what Observer plugin can do: 

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

 

https://gsap.com/docs/v3/Plugins/Observer

 

If you still need help, please start a new thread and be sure to include a minimal demo, like a CodePen, that clearly illustrates the problem and we'd be happy to help with any GSAP-specific questions. 

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