Implementation of required menu structure:
- Main Menu
- Submenu
- Contacts
- News
- Photo
- Submenu
- Submenu
- Submenu
- Submenu
- Main Menu
- Main Menu
- Main Menu
When clicking on the "Main Menu" button, a list of "Submenu" elements opens. Clicking on the "Submenu" button opens a list of menu links. The objective is to close all other "Main Menu" buttons when pressing one, and to close all other "Submenu" buttons when clicking on one.
Code Sample:
<https://codepen.io/artemkhmyrov/pen/oNMgGpd>
I have successfully implemented the functionality for the first level of the menu. When I click on a "Main Menu" button, it opens the corresponding "Submenu", and clicking on another "Main Menu" button closes the previous one. However, when clicking on a "Submenu", everything closes.