mirror of
https://github.com/Rainyy21/Rainyy21.github.io.git
synced 2026-10-10 23:40:18 -04:00
added the text box in the middle. added some content and finish the light and dark mode
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
let darkmode = localStorage.getItem('dark')
|
||||
const switch_button = document.getElementById("theme_switch")
|
||||
|
||||
const enableDarkmode = () => {
|
||||
document.body.classList.add('dark')
|
||||
localStorage.setItem('darkmode' , 'active')
|
||||
}
|
||||
|
||||
const disableDarkmode = () => {
|
||||
document.body.classList.remove('dark')
|
||||
localStorage.setItem('darkmode', null)
|
||||
}
|
||||
|
||||
if(darkmode === 'avtive') enableDarkmode()
|
||||
|
||||
switch_button.addEventListener("click", () => {
|
||||
darkmode = localStorage.getItem('darkmode')
|
||||
darkmode !== "active" ? enableDarkmode() : disableDarkmode()
|
||||
})
|
||||
Reference in New Issue
Block a user