Click here to Skip to main content
15,879,095 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I made a side navigation using HTML and CSS. Currently, it is static but I think some JavaScript could make it work.

By default, in the CSS, for each submenu body, I set the display to none (just to hide all the sub menus).

----------------------------------- What I want to achieve -----------------------------------

Whenever a user clicks on a Sub Heading, it slides downwards to reveal its sub-menu. When they click on the same Sub Heading again it closes by sliding upwards.

Also,

If a sub-menu was already opened and the user clicks on a different Sub-Heading, the initial sub menu closes, by sliding again.

Please, help me achieve this feature.

What I have tried:

See the full code here:
https://codepen.io/matthewdon/pen/KKQeVBW[^]
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900