diff --git a/src/lib/components/DriverCard.svelte b/src/lib/components/DriverCard.svelte index b17a2cd..cc5124c 100644 --- a/src/lib/components/DriverCard.svelte +++ b/src/lib/components/DriverCard.svelte @@ -43,6 +43,7 @@ + // The first element of a group of cards (e.g. driver cards or team cards) + // will register its height here, once its fully loaded. + // This height is then used as the height of following components. + // This is necessary, because for lazy loading depending on viewport intersection, + // the elements must have their actual height from the beginning. + let group_heights: { [key: string]: number } = {}; + + -
- {#if load} -
+ + +
+ {#if group_heights[group]} + +
+ + {#if imgsrc !== undefined} +
+ {:else} + +
{#if imgsrc !== undefined} { - setTimeout(() => (node.style.opacity = "1"), 10); + setTimeout(() => (node.style.opacity = "1"), 20); }; @@ -40,7 +40,7 @@ src={data} use:img_opacity_handler class="bg-surface-100 transition-opacity" - style="width: 100%; opacity: 0; transition-duration: 250ms;" + style="width: 100%; opacity: 0; transition-duration: 500ms;" {...restProps} /> {/await} diff --git a/src/lib/components/RaceCard.svelte b/src/lib/components/RaceCard.svelte index 7dee71e..3015cc4 100644 --- a/src/lib/components/RaceCard.svelte +++ b/src/lib/components/RaceCard.svelte @@ -56,6 +56,7 @@