Design comparison
SolutionDesign
Solution retrospective
This is my first solution using JavaScript. It was very challenging for me. Any feedback would be great! I added a little animation just for fun XD
Community feedback
- @ryuzaki979Posted about 3 years ago
you can show one and hide except the active links easily like this. const faqs = document.querySelectorAll('.accordion__faq') faqs.forEach(faq=>{ faq.addEventListener('click',()=>{ faq.classList.toggle('active') faqs.forEach(item=>{ if(faq!= item){ item.classList.remove('active') } }) }) })
I also did this projects. Here is my solution: https://www.frontendmentor.io/solutions/faqaccordioncard-oaerihiiF
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