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

FAQ Accordion card (using grid, flex, and JS)

Nguyen Nguyenโ€ข 340

@jesuisbienbien

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


When I click on a question and then click on a different one, the box (or the entire left side) doesn't move smoothly and it looks like a glitch haha. Any suggestion how to fix that?

Any other feedbacks are welcome as well.

Thanks in advance.

Community feedback

Ciceronโ€ข 940

@MarcusTuliusCiceron

Posted

Hi congrats on this challenge,

I think if you add a tempo between opening and closing accordeon it may look like smoother, you con try something like this:

for(let i =0; i<questionContainers.length; i++){
    questionContainers[i].addEventListener("click", (e) => {
        if(prevOpen === i) {
            close(i);
            prevOpen = null;
        }else {
            if(prevOpen!== null){
                close(prevOpen);
            }
            
            setTimeout(function() {
                   open(i);
                   prevOpen = i;  //your code to be executed after delay
            }, 300);
           
        }
    })
}

I couldn't test it as I'm currently at work :D But I think you get the idea

Hope this will help

Have a good day

Marked as helpful

0

Nguyen Nguyenโ€ข 340

@jesuisbienbien

Posted

@MarcusTuliusCiceron Thank you! I'll try it out

0
Kamasah-Dicksonโ€ข 5,610

@Kamasah-Dickson

Posted

Its because there is no enough space so it forces the container to create a space for the contents which was hidden.

  • you also forgot to add a box shadow.

You can check the link below to see my solution. (https://www.frontendmentor.io/solutions/responsive-faq-accordion-secion-made-with-css-grid-and-css-flexbox-afLOGQNaj)

Besides good job๐Ÿ‘ Happy coding๐Ÿ‘

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