You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
971 B
JavaScript

(function () {
// your page initialization code here
// the DOM will be available here
const toggler = document.querySelector(".toggler");
console.log(toggler);
toggler.addEventListener(
"click",
function (e) {
const element = document.querySelector(".navbar");
element.classList.toggle("active");
},
false
);
const isDark = localStorage.getItem("isDark");
if (isDark == 1) {
const element = document.querySelector("body");
element.classList.add("dark");
}
const themetoggler = document.querySelector(".themetoggler");
themetoggler.addEventListener(
"click",
function (e) {
e.preventDefault();
const element = document.querySelector("body");
element.classList.toggle("dark");
const isDark = localStorage.getItem("isDark");
localStorage.setItem("isDark", isDark == 1 ? 0 : 1);
},
false
);
})();