From b0244b7ac05387bb1309001c717e391326db4e94 Mon Sep 17 00:00:00 2001 From: dwindown Date: Sat, 23 Aug 2025 13:31:05 +0700 Subject: [PATCH] Fix dark/light toggle button in desktop --- index.html | 8 ++++---- script.js | 12 ++++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index 18cdc46..1e924ce 100644 --- a/index.html +++ b/index.html @@ -40,8 +40,8 @@

Emoji Glossary

@@ -49,8 +49,8 @@ diff --git a/script.js b/script.js index 3881652..a7c430f 100644 --- a/script.js +++ b/script.js @@ -40,11 +40,15 @@ document.addEventListener('DOMContentLoaded', () => { const applyTheme = (isDark) => { document.documentElement.classList.toggle('dark', isDark); // Mobile icons - lightIcon.classList.toggle('hidden', !isDark); - darkIcon.classList.toggle('hidden', isDark); + if (lightIcon && darkIcon) { + lightIcon.classList.toggle('hidden', !isDark); + darkIcon.classList.toggle('hidden', isDark); + } // Desktop icons - lightIconDesktop.classList.toggle('hidden', !isDark); - darkIconDesktop.classList.toggle('hidden', isDark); + if (lightIconDesktop && darkIconDesktop) { + lightIconDesktop.classList.toggle('hidden', !isDark); + darkIconDesktop.classList.toggle('hidden', isDark); + } }; const toggleDarkMode = () => {