Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted about 1 month ago

FAQ-accordion

accessibility, animation, jquery, pure-css
EmicJoykiller•270
@EmicJoykiller
A solution to the FAQ accordion challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What are you most proud of, and what would you do differently next time?

I'm most proud of how clean and consistent the FAQ Accordion turned out, especially the responsive design and the smooth toggling behavior for opening and closing answers. It was really satisfying to ensure the icons switched correctly between plus and minus, and that everything stayed accessible and visually balanced across different screen sizes.

Next time, I would focus more on adding small transition animations (like a smooth slide down/up effect when answers open and close) to make the experience feel even more polished. I’d also organize my JavaScript a bit more modularly for easier scalability if I wanted to add more FAQs dynamically.

What challenges did you encounter, and how did you overcome them?

One big challenge was controlling the visibility of the answers and synchronizing the icon changes (from plus to minus) without using a "toggle" icon by default. Instead, each question had its own static image, so I needed to manually switch the src attribute of the images depending on the FAQ item's open/close state.

Another challenge was making sure the first FAQ item didn’t show an unnecessary top border. Initially, using :first-child and :first-of-type didn't fully solve the issue because of how the layout was structured, but with careful CSS targeting and structure adjustments, I was able to fix it cleanly.

What specific areas of your project would you like help with?

I would love feedback on two things:

How to best add smooth open/close animations to the answer sections without causing layout shifts or performance issues.

If there are more efficient or scalable ways to structure the JavaScript, especially if I wanted to make the FAQ list dynamic in the future (like fetching questions/answers from a JSON file instead of hardcoding them in HTML).

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • P
    Joel Eguiza•320
    @joeleg96
    Posted about 1 month ago

    Hey Emic,

    Great job on your solution. Overall it looks great, and your code looks very streamlined. I found it interesting that when you clicked to show the answer, your container expanded up rather than down. Not quite sure why, but it differed from how mine responded, so I just found it interesting.

    Great job on your solution and I wish you luck on your coding journey!

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
Frontend Mentor logo

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit 1st-party linked stylesheets, and styles within <style> tags.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub