Launch countdown timer solution (Vanilla JS\Custom css)
Design comparison
Solution retrospective
I really don't have any questions about this. Any feedback would be appreciated. I would like to note that I didn't spend much time fine tuning any of the js or css, so I know there is room for improvement on that end (better organization and naming for styles/optimizations in the js for example).
Community feedback
- @Dark-LoverPosted over 3 years ago
ur solution is really impressive, the flip looks fantastic. when i will finish the challenge i will check the code of ur solution. great work !
0@Dark-LoverPosted over 3 years ago@sfallmann ur welcome. this is my solution https://www.frontendmentor.io/solutions/launch-countdown-timer-with-html-sass-and-vanilla-js-B7ALo9Gxq if you can please take a look on it and give me some feedbacks, it was my second time using sass, and im still learning js. thank you.
0@sfallmannPosted over 3 years ago@Dark-Lover Everything looks pretty good at first glance. One thing you might want to do is refactor your code a little
if (dy !== oldDay) { day_output.parentElement.querySelector(".flip_box").classList.add("active"); day_output.textContent = addZero(dy); } else day_output.parentElement .querySelector(".flip_box") .classList.remove("active"); }
you can write a reusable function like this:
function timeComparison(oldVal, newValue, $el) { if (newVal !== oldVal) { $el.parentElement.querySelector(".flip_box").classList.add("active"); $el.textContent = addZero(newVal); } else $el.parentElement .querySelector(".flip_box") .classList.remove("active"); }
1@Dark-LoverPosted over 3 years ago@sfallmann thank you a lot my dear friend for checking my solution. i appreciate it.
0
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