aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Collapsible.svelte
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Collapsible.svelte')
-rw-r--r--src/lib/Collapsible.svelte15
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>