Skip to content
IndexRequest a UIAboutContact

Scroll Reveal

Blocks fade and rise into view as they enter a scrolling area, once.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI CODING TOOL
Build a 300x200px scroll container (overflow auto, hidden scrollbar optional) containing six content blocks of 80px height each, with a small title and two grey text lines. Hide each block initially with opacity 0 and translateY(18px) using a js-enabled class on the container, so content stays visible if JavaScript fails. Use an IntersectionObserver with the container as root, threshold 0.15 and a rootMargin of 0px 0px -10% 0px: when a block intersects, add a revealed class that transitions opacity and transform over 500ms cubic-bezier(.2,.7,.2,1) with a transition-delay of 70ms times its order among blocks revealed in the same callback, then unobserve it. Because an IntersectionObserver does not fire for blocks that were skipped by a fast scroll, also listen to the container's scroll event (passive, throttled with requestAnimationFrame) and reveal any unrevealed block whose bottom edge is above the container's top edge, without a delay. Under prefers-reduced-motion add the revealed class to all blocks immediately and never hide them. Include a text hint "Scroll inside the box".

About this pattern

Definition

Content starts slightly lowered and transparent, and animates to its place the first time it scrolls into view. An IntersectionObserver detects visibility without scroll listeners.

Purpose & UX principles

  • Gives long pages a sense of progression and draws attention to what is arriving.
  • Runs once per element, so scrolling back up never re-hides content.
  • Content is fully visible without JavaScript and for reduced-motion users; the effect is a progressive enhancement.

Interaction states

  • Hidden (before), revealed (after), kept revealed on scroll back.

Motion specification

  • Opacity 0 to 1 and translateY 18px to 0, 500ms cubic-bezier(.2,.7,.2,1), with a 70ms stagger for elements entering together.
  • Reduced motion: everything is visible immediately.

Responsive behaviour

  • Uses a rootMargin so elements start revealing just before they are fully in view.
  • The same code works for the page or any scroll container.

Code

HTML
<div class="sc js" id="sc">
  <article class="bk"><b>Discover</b><i></i><i></i></article><article class="bk"><b>Explore</b><i></i><i></i></article><article class="bk"><b>Understand</b><i></i><i></i></article>
  <article class="bk"><b>Experiment</b><i></i><i></i></article><article class="bk"><b>Create</b><i></i><i></i></article><article class="bk"><b>Share</b><i></i><i></i></article>
</div>
<p class="hint">Scroll inside the box</p>

Related patterns

Staggered Entrance

↗
Staggered EntranceMotion & Transitions

Pointer Parallax Layers

↗
Pointer Parallax LayersMotion & Transitions

Skeleton Loading

↗
Skeleton LoadingLoading & Progress