Jump to content
GreenSock

Mir Moc

Add class with gsap for each section

Recommended Posts

Hi everyone,

I'm trying to add a class of .selected to the nav links whenever each of the sections enters the viewport, with gsap, but lacking basic Javscript knowledge so here for your help

Made a codepen for it. Thanks

See the Pen xxEvrgR by mirmoc (@mirmoc) on CodePen

Link to comment
Share on other sites

7 minutes ago, GreenSock said:

Hi @Mir Moc. I assume you're looking for something like this?: Thank you so much! Exactly this.

 

 

 

  • Like 1
Link to comment
Share on other sites

On 4/14/2022 at 5:37 PM, GreenSock said:

Jack, how do I reuse the function when to add something to the event listener? Using barba to load – http://mirmoc.com/

From the project page I want to go back to the main page, then run to the respective triggers you created. I think two options, either to do it with if else in your function, or to update the function in the barba hook where I go back to main page. 




Hi @Mir Moc. I assume you're looking for something like this?:

 

 

 

Link to comment
Share on other sites

Sorry, I don't really understand your question - if you still need some help, please provide a minimal demo with a GSAP-specific question and we'll do our best. Thanks!

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