Update modeTheme.js
This commit is contained in:
parent
7688e1b7b9
commit
710a0b0c78
1 changed files with 11 additions and 7 deletions
18
modeTheme.js
18
modeTheme.js
|
@ -1,10 +1,14 @@
|
||||||
function modeTheme() {
|
// license: https://www.w3schools.com/howto/howto_js_toggle_dark_mode.asp
|
||||||
|
function darkTheme() {
|
||||||
var element = document.body;
|
var element = document.body;
|
||||||
element.classList.toggle("dark-mode");
|
element.classList.toggle("dark-mode");
|
||||||
document.getElementById("btn1").style.color = "white";
|
var button = document.querySelector("button")
|
||||||
document.getElementById("btn2").style.color = "white";
|
button.classList.add("dark-modeBtn")
|
||||||
document.getElementById("btn3").style.color = "white";
|
}
|
||||||
document.getElementById("btn4").style.color = "white";
|
|
||||||
document.getElementById("btn5").style.color = "white";
|
function lightTheme() {
|
||||||
document.getElementById("btn6").style.color = "white";
|
var body = document.querySelector("body")
|
||||||
|
body.classList.remove("dark-mode")
|
||||||
|
var button = document.querySelector("button")
|
||||||
|
button.classList.remove("dark-modeBtn")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue