Design comparison
Solution retrospective
Tips appreciated! I totally could've used less JS code.
Community feedback
- @elaineleungPosted about 2 years ago
Hi Jake, well done here, and yes, I do agree that you could use less code as well. But first off, just wanted to say I like the transition to the thank you card, which I haven't seen in any other solution. I've seen someone do a flip animation, but definitely a first for a slide up, and it's pretty cool I think!
About the JS, instead of querying each button individually, I would use
querySelectorAll
to grab all the buttons as group, and then in the line when the "review-active" style needs to be removed, I would just loop through the whole group instead of needing to write out each line individually. I also might just remove the "if" statement for checking whether a button has the "review-active" class, which really is only applicable for the first time the button is clicked.Anyway, if you'd like a comparison on how else the JS could be written, you can check out this CodePen I wrote as a mini component of this challenge: https://codepen.io/elaineleung/pen/RwMqMxZ
Once again, great work over all 😊
Marked as helpful0@jakewebdPosted about 2 years ago@elaineleung thank you! i wasnt sure how to make it that the review active class goes away when clicking a different button without doing it like that as applying classList.remove to just reviews (which is the array of review items) didnt actually remove it from all of them so i did each one individually.
1
Please log in to post a comment
Log in with GitHubJoin 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