Design comparison
Solution retrospective
This challenge took me quite a while, I would like to know is there any better way to change themes than just hardcoding it in js, thanks for every feedback :)
Community feedback
- @LucianoDLimaPosted over 1 year ago
Hey well done on completing this challenge!
Just to let you know that I don't think it's working at the moment, when I try to press the operators, it just deletes everything.
I'm working at the moment but I will edit this comment after work to tell you a better way of accomplishing the themes instead of using hardcoded javascript if no one else does by then
Good luck!
0@RogowiakPosted over 1 year ago@LucianoDLima Operators clear the input div, but inserted number is stored in the variable, calculator works just fine, it just doesn't display inserted value
0@LucianoDLimaPosted over 1 year ago@Rogowiak
You're right, I'm used to things calculating as you press the operators as well as the = symbol. Tested now again and it is working as you described.
About your themes now, there's a few ways of accomplishing that. You could create a stylesheet for each theme and then apply it to your html with javascript, this video shows how to do it: The video here
Or you could just add a class or attribute to your body like this, and then you use javascript to add and remove the class to your body.
These are 2 different ways you could go about that
:root { --color-1: #999; } body.dark-mode { --color-1: #000; } body { background-color: var(--color-1); }
Marked as helpful0
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