This is my best frontend-mentor challenge. Because I haven't had experience with API or local-storage yet. Thanks to this challenge, I learned to work with both the API and the local-storage. I practiced my skills in building a bigger project. I am proud of my solution. Almost pixels perfect!
Eduek
@the-eduekAll comments
- @ttoomasSubmitted almost 3 years ago@the-eduekPosted almost 3 years ago
As you should!!!!
This really is amazing and it's actually pixel-perfect.
0 - @DEmanderbagSubmitted almost 4 years ago
I've tried but at this point, I was not able to have only one open accordion at the time, I've tried a couple of ways but they were not successful, with the current code I have.
@the-eduekPosted almost 4 years agoWell done!
It's a near perfect design. To make not more than one accordion at the same time, you could try setting the active states with classes.
Currently, your JS code would raise inline styles but you could set an accordion active state with a class and toggle that class anytime an accordion is open.
This way, you could create an array with a length of 2 i.e. use a for loop of
i <= 2
of all accordions with the active class and when an accordion is clicked it removes the active state from the first element in the array and only the newly clicked has the accordion active class since on click, that accordion should be toggled the active class.1