A Svelte 5 implementation of scroll-triggered parallax animations with Intersection Observer API.
pnpm run dev
Pros:
Cons:
Pros:
Cons:
For your invitation site, consider the action approach for easier expansion.
Use a single scroll container for the entire page:
<div bind:this={scrollContainer} class="main-container">
<!-- All parallax sections -->
<section><div use:scrollReveal={{ root: scrollContainer }}></div></section>
<section><div use:scrollReveal={{ root: scrollContainer }}></div></section>
</div>
Best for: Full-page scrolling experiences with consistent behavior.
Each section has its own scroll container:
{#each sections as section}
<div bind:this={section.container} class="section-wrapper">
<section><div use:scrollReveal={{ root: section.container }}></div></section>
</div>
{/each}
Best for: Individual section scrolling (e.g., snap-scrolling layouts) or Svelte Components.
pnpm install
pnpm dev
See src/lib/actions/scrollReveal.ts for full API details.
Demo: http://localhost:5173/