water.css/script.js

11 lines
379 B
JavaScript
Raw Normal View History

2019-04-05 09:09:13 -04:00
document.getElementById('switch').addEventListener('click', () => {
const { body } = document
const ph = document.getElementById('ph')
2019-04-05 09:21:05 -04:00
if (body.classList.contains('light')) {
body.classList.remove('light')
2019-04-05 09:09:13 -04:00
ph.src = ph.src.replace('theme=light', 'theme=dark')
} else {
2019-04-05 09:21:05 -04:00
body.classList.add('light')
2019-04-05 09:09:13 -04:00
ph.src = ph.src.replace('theme=dark', 'theme=light')
}
})