Accordion responsive menu using javascript
Design comparison
Solution retrospective
I created the accordion menu by adding and removing the 'active' class using classList methods like classList.remove or classList.add. Also use classList.toggle to make the 'active' class dynamic. This accordion menu can be made directly from HTML using the <details>
and <summary>
tags that allow the text within <summary>
to be displayed:
details>
<summary>How many team members can I invite?</summary>
<p>You can invite up to 2 additional users on the Free plan. There is no
limit on team members for the Premium plan.</p>
</details>
Community feedback
- @jcboteroPosted 9 months ago
Hello Federico. Good code. If you don't mind, the only thing I would have to add is that I think you forgot to cut the image that comes out of the div with a white background. You can do this like this in css:
div containing the image { overflow: hidden }
If you think this helped you, please mark the comment as helpful. Thank you!
Marked as helpful0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord