diff --git a/index.html b/index.html index 46ecb77..92f72a8 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,7 @@ Water.css - + diff --git a/script.js b/script.js index ea670de..8017c91 100644 --- a/script.js +++ b/script.js @@ -1,11 +1,8 @@ document.getElementById('switch').addEventListener('click', () => { - const { body } = document - const ph = document.getElementById('ph') - if (body.classList.contains('light')) { - body.classList.remove('light') - ph.src = ph.src.replace('theme=light', 'theme=dark') + const css = document.getElementById('watercss'); + if (css.getAttribute('href') == 'dist/water-dark.css') { + css.setAttribute('href', 'dist/water-light.css') } else { - body.classList.add('light') - ph.src = ph.src.replace('theme=dark', 'theme=light') + css.setAttribute('href', 'dist/water-dark.css') } }) \ No newline at end of file