diff options
author | Zach Berwaldt <17715430+zberwaldt@users.noreply.github.com> | 2023-10-20 22:58:33 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-20 22:58:33 -0400 |
commit | c516745d0dc2c6a51777ef00ef116c1b26e95ec7 (patch) | |
tree | adcce31c689d3e63ab3ea8bd36f9ac384eca4cad /assets/js/darkmode.js | |
parent | b34e09f8fe1011963934dbf40dc92f0b258592ca (diff) | |
parent | 6bfd84ae2c7aad006c3bc84cdce9aebf894cbe62 (diff) |
Develop
Diffstat (limited to 'assets/js/darkmode.js')
-rw-r--r-- | assets/js/darkmode.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/assets/js/darkmode.js b/assets/js/darkmode.js new file mode 100644 index 0000000..c6094d0 --- /dev/null +++ b/assets/js/darkmode.js | |||
@@ -0,0 +1,11 @@ | |||
1 | // get with web apis #fullscren element and on click toggle fullscreen | ||
2 | const darkmode = document.getElementById('darkmode'); | ||
3 | const html = document.querySelector('html'); | ||
4 | darkmode.addEventListener('click', () => { | ||
5 | if (html.dataset.theme === 'dark') { | ||
6 | html.dataset.theme = 'light'; | ||
7 | } else { | ||
8 | html.dataset.theme = 'dark'; | ||
9 | } | ||
10 | }); | ||
11 | |||