From b207f51b84e207935db484953b33df475bc49271 Mon Sep 17 00:00:00 2001 From: Simeon Widdis Date: Sun, 15 Aug 2021 00:26:12 -0600 Subject: [PATCH] Disable transitions when setting theme on startup Remove a silly extra newline Remove unnecessary !important statements --- app.css | 7 +++++++ assets/js/theme.js | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/app.css b/app.css index f4dd55b..4661ec4 100644 --- a/app.css +++ b/app.css @@ -56,6 +56,13 @@ transition: 0.2s ease-in-out; } +.notransition { + -webkit-transition: none; + -moz-transition: none; + -o-transition: none; + transition: none; +} + .withImageBackground { background-image: var(--imgcol), var(--imgbg); background-size: cover; diff --git a/assets/js/theme.js b/assets/js/theme.js index 06c4234..9822d2b 100644 --- a/assets/js/theme.js +++ b/assets/js/theme.js @@ -25,7 +25,11 @@ const disableDark = () => { //Toggle theme if (darkTheme === 'enabled') { + // Temporarily disable transitions when changing theme on startup + document.body.classList.add('notransition'); enableDark(); + document.body.offsetHeight; // Trigger reflow to flush CSS changes + document.body.classList.remove('notransition'); } else { disableDark(); }