@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
@jesuisbienbien
Posted
@MarcusTuliusCiceron Thank you! I'll try it out