Skip to content

Commit

Permalink
Skript angepasst
Browse files Browse the repository at this point in the history
  • Loading branch information
KTuff committed Oct 24, 2023
1 parent 50ea06b commit 7b8ee26
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,7 @@
<script src="https://cdn.jsdelivr.net/npm/vue-router/dist/vue-router.js"></script>
<script src="app.js"></script>
<script>
const button = document.getElementById('theme-button');
button.addEventListener('click', () => {
function switchTheme() {
const themeName = localStorage.getItem('theme') || 'light';
if (themeName === 'dark') {
theme = 'light';
Expand All @@ -186,7 +185,12 @@
const html = document.documentElement;
html.setAttribute('class', theme);
localStorage.setItem('theme', theme);
});
}

const button = document.getElementById('theme-button');
window.onload = () => {
button.addEventListener('click', switchTheme);
}
</script>
</body>
</html>

0 comments on commit 7b8ee26

Please sign in to comment.