Disable transitions when setting theme on startup

Remove a silly extra newline

Remove unnecessary !important statements
This commit is contained in:
Simeon Widdis 2021-08-15 00:26:12 -06:00
parent 296227e9fc
commit b207f51b84
2 changed files with 11 additions and 0 deletions

View File

@ -56,6 +56,13 @@
transition: 0.2s ease-in-out; transition: 0.2s ease-in-out;
} }
.notransition {
-webkit-transition: none;
-moz-transition: none;
-o-transition: none;
transition: none;
}
.withImageBackground { .withImageBackground {
background-image: var(--imgcol), var(--imgbg); background-image: var(--imgcol), var(--imgbg);
background-size: cover; background-size: cover;

View File

@ -25,7 +25,11 @@ const disableDark = () => {
//Toggle theme //Toggle theme
if (darkTheme === 'enabled') { if (darkTheme === 'enabled') {
// Temporarily disable transitions when changing theme on startup
document.body.classList.add('notransition');
enableDark(); enableDark();
document.body.offsetHeight; // Trigger reflow to flush CSS changes
document.body.classList.remove('notransition');
} else { } else {
disableDark(); disableDark();
} }