Put wait cursor globally when page is loading

don't use a div over everything as it interacts with the current hover state of elements
instead force a cursor on every element in body when the body has a loading class
This commit is contained in:
2022-11-13 23:16:54 +01:00
parent e3f36d1810
commit 225cd6fe00
2 changed files with 6 additions and 4 deletions

View File

@@ -43,6 +43,9 @@
$previousPage = from.url.pathname $previousPage = from.url.pathname
}) })
// Define page loading
$: browser && document.body.classList.toggle('is-loading', $pageLoading)
onMount(() => { onMount(() => {
// Avoid FOUC // Avoid FOUC
@@ -69,10 +72,6 @@
<Footer /> <Footer />
{/if} {/if}
{#if $pageLoading}
<div class="page-loading" />
{/if}
<SVGSprite /> <SVGSprite />
<SmoothScroll /> <SmoothScroll />

View File

@@ -28,6 +28,9 @@ html {
&.block-scroll { &.block-scroll {
overflow: hidden; overflow: hidden;
} }
&.is-loading * {
cursor: wait !important;
}
} }
body { body {
@include font-smooth; @include font-smooth;