FAQ accordion card | Html + Css + JS => open only one item
Design comparison
Solution retrospective
I would appreciate any feedback, thank you in advance.
Community feedback
- @tdenis29Posted about 3 years ago
Hey man it looks good but the inverted svg is giving a 400 error when I click on the tabs.
I just did this for another challenge on this site. I used the <details> and <summary> tags built into html because it's more accessible from what I read, i dont actually know.
I used an event listener on the summary element container then just inverted the svg and changed the color with combo classes. I had to give unique id to each summary element though.
summary.addEventListener('click', (e) => { if(e.target.id === "details1"){ document.getElementById('detail1arrow').classList.toggle('flippy'); }
svg.flippy { transform: rotate(180deg); }
.flippy path { stroke: #fa5757; }
0
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