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

Accordion using HTML CSS and JavaScript

Dipu 430

@immdipu

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 wanted to make like if one accordion is open then all other accordion should be closed automatically but i couldn't. though its easy with Bootstrap but i don't like Boootstrap.

Also when i was positioning the box it was so hard to keep it fixed in one position while resizing the screen because its position was absolute.

Community feedback

Abdul 8,540

@Samadeen

Posted

Hey!! Cheers 🥂 on completing this challenge.. .

Here are my suggestions..

  • You should use <main class="container"> instead of <div class="container">.
  • You can wrap your attribution section in a footer tag to avoid accessibility issues.

This should fix most of your accessibility issues

. Regardless you did amazing... hope you find this useful... Happy coding!!!

Marked as helpful

1

@fazzaamiarso

Posted

Hello Dipu! Nice work!

Here is my solution to your question.

for (const items of faq) {
    items.addEventListener('click', function () {
		faq.forEach(item => {
			item.classList.remove('activate')
		}) // close all accordion
        items.classList.add('activate') // open the clicked accordion
    })
}

I hope it helps! Goodluck!

1

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