Open lazzaror opened 4 years ago
Sweeeet, I really like the different background based on the theme and that it's totally based on a CSS class! The local storage part is working great too. Nice job! 🤘
I have one recommendation to touch up the page counter. Would you mind trying this out?
1
on first visit to pageWhen I first visited the page, I saw NaN
as the page count:
On subsequent visits I saw the number start at 1 and increase each time I refreshed the page, so I'm convinced that the local storage bit is working correctly.
Would you mind adjusting the code so it shows 1
on the first page visit instead of NaN
? You can run window.localStorage.clear()
to remove all of the saved values in local storage to reproduce this issue.
After you’ve made your changes and pushed them to GitHub and your hosted site, give it a once-over to make sure it looks right, then comment back here and I’ll take another look.
Thanks! 🎸
Thanks! Just fixed it
Nailed it. Nice work! 🔨 :shipit:
Build a website that allows the user to switch between day and night color themes and remembers their choice
@egillespie Can you take a look at this? It's hosted here and meets the following criteria:
localStorage
body
element is always up-to-date with the current theme (eitherday-theme
ornight-theme
) -- you can usedocument.body.setAttribute('class', 'some-class-name')
to set the class on thebody
day-theme
, the background of the website is light-colored, with a darker color for the textnight-theme
, the background of the website is a very dark color, with a lighter color for the text1
the first time)