diff options
author | mat <github@matdoes.dev> | 2022-04-09 17:16:50 -0500 |
---|---|---|
committer | mat <github@matdoes.dev> | 2022-04-09 17:16:50 -0500 |
commit | f3abc77ac9333ee115704645437511baacee85e8 (patch) | |
tree | 5e2a15a3d535a0055de69b44f1aabb85bdb42778 /src/lib/Collapsible.svelte | |
parent | 16403a7d834bbe1f2f4dddf8791baa8a1163222b (diff) | |
download | skyblock-stats-f3abc77ac9333ee115704645437511baacee85e8.tar.gz skyblock-stats-f3abc77ac9333ee115704645437511baacee85e8.tar.bz2 skyblock-stats-f3abc77ac9333ee115704645437511baacee85e8.zip |
don't lazy load collapsible leaderboard sections
improves seo and stuff
Diffstat (limited to 'src/lib/Collapsible.svelte')
-rw-r--r-- | src/lib/Collapsible.svelte | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/lib/Collapsible.svelte b/src/lib/Collapsible.svelte index 615f9ce..e1f28b2 100644 --- a/src/lib/Collapsible.svelte +++ b/src/lib/Collapsible.svelte @@ -9,6 +9,7 @@ let open: boolean export let id: string | undefined = undefined + export let lazy = true function checkHash() { if (id && id === location.hash.slice(1)) { @@ -27,15 +28,19 @@ </slot> </summary> <div> - <!-- + {#if lazy} + <!-- We do this so images and other things inside the content are not loaded until it's open. For some reason browsers don't handle this, although they should. --> - <noscript> - <slot /> - </noscript> - {#if open} + <noscript> + <slot /> + </noscript> + {#if open} + <slot /> + {/if} + {:else} <slot /> {/if} </div> |