Jump to content
Search Community

Dropdown Menu and Collapse All

AriesDatuin test
Moderator Tag

Recommended Posts

Hello guys,

I'm trying to create a dropdown navigation/menu, but having difficulties figuring out the logic. I posted a crude example Pen of what I have so far.

 

Basically, I have a timeline that animates the expand/collapse of a dropdown menu.

The difficult part I am trying to wrap my head around is: the clicked menu should expand while everything else should collapse, similar to an accordion. Also clicking on the expanded menu will also collapse it.

 

I've tried using a class, labels, checking the state of the timeline, etc., but my brain can't seem to comprehend what the logic should look like. I end up cluttering the code and overcomplicating things.

 

Any help in the right direction is appreciated

See the Pen xxdwLBq?editors=1010 by allistar-tenpenny (@allistar-tenpenny) on CodePen

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