diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tour.gleam | 2 | ||||
-rw-r--r-- | src/tour/widgets.gleam | 11 |
2 files changed, 1 insertions, 12 deletions
diff --git a/src/tour.gleam b/src/tour.gleam index ef4ed02..2a64561 100644 --- a/src/tour.gleam +++ b/src/tour.gleam @@ -1000,7 +1000,7 @@ pub fn render_page_html(page config: PageConfig) -> Html { ], ), lang: "en-GB", - attributes: [#("class", "theme-light theme-init")], + attributes: [#("class", "theme-light")], body: BodyConfig( attributes: [body_class], scripts: config.scripts.body, diff --git a/src/tour/widgets.gleam b/src/tour/widgets.gleam index 3a6f0a0..8ac9f08 100644 --- a/src/tour/widgets.gleam +++ b/src/tour/widgets.gleam @@ -138,15 +138,6 @@ function toggleTheme() { setTheme(getAppliedTheme() === 'dark' ? 'light' : 'dark'); } -function reEnableTransitions() { - // re-enable transitions when triggered after first-render to avoid fouc - // setTimeout(fn, 0) needed to give CSS at lease 1 frame without transitions and thus avoid FOUC - setTimeout(() => { - // executed after css has loaded & theme swiching has occured - document.documentElement.classList.toggle('theme-init', false); - }, 0); -} - function initThemeEvents() { // Watch the device's preferred theme and update theme if user did not select a theme mediaPrefersDarkTheme.addEventListener('change', () => { @@ -159,8 +150,6 @@ function initThemeEvents() { document .querySelector('.theme-picker') ?.addEventListener('click', toggleTheme); - // Re-enable transitons only when all content has loaded - window.addEventListener('DOMContentLoaded', reEnableTransitions); } function initTheme() { |