From 9bf38d27956edf76ac28859521f673b21acc9b51 Mon Sep 17 00:00:00 2001 From: "Simon L." Date: Fri, 18 Oct 2024 15:56:39 +0200 Subject: [PATCH] only apply saved theme when dom content has loaded Signed-off-by: Simon L. --- php/public/toggle-dark-mode.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/php/public/toggle-dark-mode.js b/php/public/toggle-dark-mode.js index 9fc17193..773a9f18 100644 --- a/php/public/toggle-dark-mode.js +++ b/php/public/toggle-dark-mode.js @@ -22,5 +22,5 @@ function applySavedTheme() { } } -// Immediately apply the saved theme -applySavedTheme(); +// Apply theme when the page loads +document.addEventListener('DOMContentLoaded', applySavedTheme);