global : preload bg-fixed background image before showing. related to #55
All checks were successful
Deploy / Deploy to Production (push) Successful in 21s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
isUnknown 2026-04-03 12:20:40 +02:00
parent c6c7ad3fca
commit 9d7fca4d91

View file

@ -52,9 +52,18 @@
let isReady = $state(false)
let isResizing = $state(false)
let bgReady = $state(false)
let resizeTimer = null
let mediaCheckCleanup = null
// Preload bg-fixed image, show only once fully loaded
const BG_URL = '/assets/img/scrollable-page-background.png'
{
const img = new Image()
img.onload = () => { bgReady = true }
img.src = BG_URL
}
// Active la transition seulement après le premier paint à la bonne position.
// Double rAF : le premier laisse passer un paint avec le bon translateX,
// le second active is-animated — évite l'animation parasite au chargement.
@ -219,7 +228,9 @@
<Cursor />
<Header />
<div class="bg-fixed" style="background-image: url('/assets/img/scrollable-page-background.png')"></div>
{#if bgReady}
<div class="bg-fixed" style="background-image: url('{BG_URL}')"></div>
{/if}
<div class="vertical-lines" aria-hidden="true">
{#each ALL_COLS as col}