Jump to content
Search Community

scrollTrigger scrollTo active class on nav

DD77 test
Moderator Tag

Go to solution Solved by _Greg _,

Recommended Posts

I'm quite stuck here, as I need a class active on the navigation Menu
- the current section should have the relative menu active. 
is it possible to achieve this?  I used to use className - and + but I know is not longer supported. 

I'm also terrible confused with how the toggleClass/toggleAction works.

 
Please come to the rescue . . . 

See the Pen vYxZMxB by davide77 (@davide77) on CodePen

Link to comment
Share on other sites

  • Solution

Hi @DD77 I'm not sure that i understand you well

 

12 minutes ago, DD77 said:

I'm also terrible confused with how the toggleClass/toggleAction works.

toggleClass add/remove class to trigger element

I add in css 

.active {
  color: red !important;
}

and change 

panels.forEach((panel, i) => {....}

part

See the Pen gOmRyRP?editors=0110 by gregOnCodePen (@gregOnCodePen) on CodePen

 

That what you need?

  • Like 1
Link to comment
Share on other sites

Hi pal, I replied to your other question.

Here's the pen I linked to to demo toggleClass

See the Pen ba2c5243a07686ef1fdbcb0f9c76a10b by cassie-codes (@cassie-codes) on CodePen



Here's a demo to show when the events that influence the toggleActions states fire - 


See the Pen e5a513ccbf59d14b207e080793407167 by cassie-codes (@cassie-codes) on CodePen



Hope this helped - In future can you avoid posting duplicates, as it can double the effort put in from folks trying to help and make things a bit confusing. Thanks!

  • Like 5
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...