- Tap the menu icon
- Select a link
- The URL changes in the background.
- However, the menu remains open. How do I close the menu when a link is selected? The menu is wrapped in a details HTML element.
Is there a way to remove the "open" attribute from the details?
I would appreciate simple suggestions, as I am a designer with limited knowledge of JavaScript. Thank you!
Below is my code for the navigation:
<details>
<summary class='menu'>
<div class='line line1'></div>
<div class='line line2'></div>
<div class='line line3'></div>
</summary>
<div class='dropdownMenu'>
<div class='column'>
<label>Categories</label>
<a class='link' href='/category1'>Category 1</a>
<a class='link' href='/category2'>Category 2</a>
<a class='link' href='/category3'>Category 3</a>
</div>
<div class='column'>
<label>Contact Us</label>
<a class='link' href='mailto:info@example.com'>info@example.com</a>
<a class='link' href='tel:1234567890'>(123) 456-7890</a>
</div>
</div>
</details>