Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Responsive mobile-first FAQ Accordion

@olesiakissa

Desktop design screenshot for the FAQ accordion card coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


I would be deeply thankful for the feedback according:

  • images positioning (maybe it can be improved by placing it as an img tag instead of using it as a background on a div?)

  • logic of collapsibles in my main.js file (is there any way to improve event listener? I have found a lot of examples where listeners were attached in the loop, but maybe it is more effective to attach one listener on the items container and then kind of listen for the 'target' element that is being clicked?)

Community feedback

Eles 1,300

@eleswastaken

Posted

Good job!

img tags are supposed to represent some kind of meaning, product, illustration... Whereas background images are solely for design purposes. So, I am not sure what would be the problem, there is no right solution, remember:)?

About the collapsibles, yes, there is such a thing called event delegation. But the use case would be for something much larger, say, a table 100x100. There it would be inefficient to loop through every cell, you could just listen to the container, and use the event.target for logic. In your case I am positive there is no need for that.

Side note: For things like collapsibles it would be a lot better to use <details> and <summary> tags. They have a semantic meaning and are accessible.

Good luck!

Marked as helpful

1

@olesiakissa

Posted

@eleswastaken Thank you for the advices! I'll make sure to check out those tags.

I was thinking that the <button>s would be okay because they are focusible but your suggestion on <details> & <summary> tags is really great.

Have a nice day! :)

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join 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