small js change

This commit is contained in:
Wonderfall 2022-07-25 01:41:59 +02:00
parent 17fd82358d
commit 5737f8613c

View File

@ -43,7 +43,9 @@ function scrollToTop() {
} }
function themeToggle() { function themeToggle() {
document.getElementById("theme-toggle").addEventListener("click", () => { var themeButton = document.getElementById("theme-toggle");
themeButton.addEventListener("click", () => {
if (document.body.className.includes("dark")) { if (document.body.className.includes("dark")) {
document.body.classList.remove('dark'); document.body.classList.remove('dark');
localStorage.setItem("pref-theme", 'light'); localStorage.setItem("pref-theme", 'light');