feat: theme button
This commit is contained in:
@@ -22,7 +22,7 @@ if (theme !== null) {
|
||||
}
|
||||
|
||||
theme_switcher.addEventListener("click", () => {
|
||||
if (theme_switcher.textContent.indexOf("off") !== -1) {
|
||||
if (theme_switcher.getAttribute("title").indexOf("off") !== -1) {
|
||||
changeToDarkTheme();
|
||||
} else {
|
||||
changeToLightTheme();
|
||||
@@ -30,7 +30,7 @@ theme_switcher.addEventListener("click", () => {
|
||||
});
|
||||
|
||||
function changeToDarkTheme() {
|
||||
theme_switcher.textContent = "turn the light on";
|
||||
theme_switcher.setAttribute("title", "turn the light on");
|
||||
document.documentElement.style.setProperty("--border", "var(--dark-border)");
|
||||
document.documentElement.style.setProperty("--text", "var(--dark-text)");
|
||||
document.documentElement.style.setProperty("--bg", "var(--dark-bg)");
|
||||
@@ -41,7 +41,7 @@ function changeToDarkTheme() {
|
||||
}
|
||||
|
||||
function changeToLightTheme() {
|
||||
theme_switcher.textContent = "turn the light off";
|
||||
theme_switcher.setAttribute("title", "turn the light off");
|
||||
document.documentElement.style.setProperty("--border", "var(--light-border)");
|
||||
document.documentElement.style.setProperty("--text", "var(--light-text)");
|
||||
document.documentElement.style.setProperty("--bg", "var(--light-bg)");
|
||||
@@ -84,12 +84,10 @@ window.addEventListener("resize", () => {
|
||||
}
|
||||
});
|
||||
|
||||
main.addEventListener("click", (event) => {
|
||||
main.addEventListener("click", () => {
|
||||
if (sections_button.getAttribute("opened") === "true") {
|
||||
closeMenu();
|
||||
}
|
||||
});
|
||||
|
||||
// DEBUG;
|
||||
console.log(window.innerWidth);
|
||||
console.log(window.innerHeight);
|
||||
|
||||
|
Reference in New Issue
Block a user