Dark Mode Toggle
I have tried and tried again to get this toggle to work. I have included a link to my github repo. In the top part of the script.js file is the over-engineered script that I commented out. Below is the script Kevin had on youtube. Any help on this is much appreciated! PS: This is the error I get : TypeError: can't access property "addEventListener", darkModeToggle is null
https://github.com/andrewteece/social-media-dashboard
GitHub
GitHub - andrewteece/social-media-dashboard
Contribute to andrewteece/social-media-dashboard development by creating an account on GitHub.
17 Replies
Got the error fixed. It was a simple typo, but the script does not work.
I was looking at it, was it the toogle id typo?
Yes it was. So that problem is fixed, but now the script does not do anything.
Watching the dev tools and the body should have "darkmode" added to it with the script, but that does not seem to happen.
where can we see this running?
clone the repo, @epic2937
@andrewteece the problem now is with your css, i'm trying to figure it out
Thats what I was thinking. My commented out code at the top of the script.js file was the original code I wrote. The code being used now it the code I found from Kevin. The css is still written for the original js code.
@sacarima thank you
This problem is driving me insane lol
it's not a css or a javascript issue: it's an issue with you not using the right variables
none of the variables inside the .darkmode are used anywhere
ok I will look at that
@epic2937 thank you
you're welcome
Just going to redo the variables
you don't need to re-do, you just need to use the ones you had, but weren't using
also, since you're using scss, i would recommend that you create a map with all the colors, instead of manually creating the variables
great thank you for your help
you're welcome
Something like this map but for colors
yes
Very helpful advice, thanks again
you're welcome