water.css/docs/script.js

11 lines
347 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')
if (body.className) {
body.className = ''
ph.src = ph.src.replace('theme=light', 'theme=dark')
} else {
body.className = 'light'
ph.src = ph.src.replace('theme=dark', 'theme=light')
}
})