mirror of
https://github.com/kognise/water.css.git
synced 2025-08-15 01:24:46 +02:00
Fixed demo page references/theme switcher
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
<html lang='en'>
|
<html lang='en'>
|
||||||
<head>
|
<head>
|
||||||
<title>Water.css</title>
|
<title>Water.css</title>
|
||||||
<link rel='stylesheet' href='water.css'>
|
<link id="watercss" rel='stylesheet' href='dist/water-dark.css'>
|
||||||
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
|
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
|
||||||
|
|
||||||
<script async src='https://www.googletagmanager.com/gtag/js?id=UA-116663597-6'></script>
|
<script async src='https://www.googletagmanager.com/gtag/js?id=UA-116663597-6'></script>
|
||||||
|
11
script.js
11
script.js
@@ -1,11 +1,8 @@
|
|||||||
document.getElementById('switch').addEventListener('click', () => {
|
document.getElementById('switch').addEventListener('click', () => {
|
||||||
const { body } = document
|
const css = document.getElementById('watercss');
|
||||||
const ph = document.getElementById('ph')
|
if (css.getAttribute('href') == 'dist/water-dark.css') {
|
||||||
if (body.classList.contains('light')) {
|
css.setAttribute('href', 'dist/water-light.css')
|
||||||
body.classList.remove('light')
|
|
||||||
ph.src = ph.src.replace('theme=light', 'theme=dark')
|
|
||||||
} else {
|
} else {
|
||||||
body.classList.add('light')
|
css.setAttribute('href', 'dist/water-dark.css')
|
||||||
ph.src = ph.src.replace('theme=dark', 'theme=light')
|
|
||||||
}
|
}
|
||||||
})
|
})
|
Reference in New Issue
Block a user