StealThis .dev

Scroll Fade In

Smooth fade-in animation triggered by Intersection Observer as elements enter the viewport on scroll.

Open in Lab
css js intersection-observer vue svelte
Targets: TS JS HTML React Vue Svelte

Code

Scroll Fade In

A lightweight scroll-triggered fade-in animation using the native Intersection Observer API — no libraries required.

How it works

Elements start invisible (opacity: 0, slightly translated down) and fade in once they enter the viewport. The observer disconnects after the element is visible, keeping things performant.

When to use it

  • Hero sections with staggered content
  • Blog post cards loading as you scroll
  • Feature grids on landing pages

Tech used

  • IntersectionObserver — native browser API, zero dependencies
  • CSS transitions — smooth, GPU-accelerated

Accessibility

Respects prefers-reduced-motion by skipping the animation for users who prefer it.