From 3f800fb6724a15e6355b73304246a4711231d28f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Herg=C3=A8s?= Date: Sat, 9 Aug 2025 18:47:42 +0200 Subject: feat(ref): mosaic bg --- src/pages/index.astro | 61 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 47 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/pages/index.astro b/src/pages/index.astro index 5882ff4..3d5da47 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -89,19 +89,48 @@ import Base from "../layout/Base.astro";
- - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
@@ -141,7 +170,11 @@ import Base from "../layout/Base.astro"; document.addEventListener("scroll", () => { sections.forEach((section) => { const rect = section.getBoundingClientRect(); - if (rect.top > window.scrollY || rect.bottom * 2.5 < window.scrollY) return; + if ( + section.top + window.scrollY > window.scrollY || + (rect.bottom + +window.scrollY) * 2 < window.scrollY + ) + return; const content = section.querySelector(".content"); if (content == null || !(content instanceof HTMLElement)) throw new Error(`Invalid section ${section}`); -- cgit v1.2.3