global : preload bg-fixed background image before showing. related to #55
All checks were successful
Deploy / Deploy to Production (push) Successful in 21s
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:
parent
c6c7ad3fca
commit
9d7fca4d91
1 changed files with 12 additions and 1 deletions
|
|
@ -52,9 +52,18 @@
|
||||||
|
|
||||||
let isReady = $state(false)
|
let isReady = $state(false)
|
||||||
let isResizing = $state(false)
|
let isResizing = $state(false)
|
||||||
|
let bgReady = $state(false)
|
||||||
let resizeTimer = null
|
let resizeTimer = null
|
||||||
let mediaCheckCleanup = 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.
|
// Active la transition seulement après le premier paint à la bonne position.
|
||||||
// Double rAF : le premier laisse passer un paint avec le bon translateX,
|
// Double rAF : le premier laisse passer un paint avec le bon translateX,
|
||||||
// le second active is-animated — évite l'animation parasite au chargement.
|
// le second active is-animated — évite l'animation parasite au chargement.
|
||||||
|
|
@ -219,7 +228,9 @@
|
||||||
|
|
||||||
<Cursor />
|
<Cursor />
|
||||||
<Header />
|
<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">
|
<div class="vertical-lines" aria-hidden="true">
|
||||||
{#each ALL_COLS as col}
|
{#each ALL_COLS as col}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue