mirror of
https://github.com/animate-css/animate.css.git
synced 2024-11-16 17:18:27 +01:00
3d9aef2ba6
* corrections were made * added dark-mode * back-to-top-button added * back-to-top button edited * back-to-top button edited * last edit * last edit * arrangements were made * dark-mode-button-updated * dark-mode-option-added
20 lines
No EOL
539 B
JavaScript
20 lines
No EOL
539 B
JavaScript
const darkModeControl = () => {
|
|
const darkCheck = document.getElementById('night-light-checkbox');
|
|
|
|
darkCheck.addEventListener('click', () => {
|
|
if (darkCheck.checked) {
|
|
document.body.classList.add('dark');
|
|
localStorage.setItem('animate-css', 'dark');
|
|
} else {
|
|
document.body.classList.remove('dark');
|
|
localStorage.removeItem('animate-css');
|
|
}
|
|
})
|
|
|
|
if (localStorage.getItem('animate-css')) {
|
|
document.body.className = 'dark';
|
|
darkCheck.checked = true;
|
|
}
|
|
}
|
|
|
|
export default darkModeControl; |