WBL Code LibraryFlow · 1.5 KB

Scroll scenes (CSS scroll-driven)

Reading progress bar, image parallax bands and soft fade-ups, driven by native CSS scroll timelines (off the main thread), with a tiny JS fallback for older browsers.

Scroll: the bar at the very top tracks reading progress; the band photos drift; the cards rise softly as they enter.

Two chairs, no rush

Maria opened the studio on Sunset in 2012. One appointment per stylist at a time.

Stylist and client
The studio floor in afternoon light

Prices

  • Women's cut + blow-dry$65
  • Men's cut$40
  • Gloss / toner$55
  • Root touch-up$85
  • Balayagefrom $220
Colour going on foils
Nude manicure

Nails at the back table

Gel and natural, short and square is the house favourite.

2214 W Sunset Blvd

Tue–Sun. Walk-ins until 30 minutes before close.

How to use it

Size
1.5 KB gzipped own code (JS 0.8 KB + CSS 0.7 KB; 3.1 KB raw)
Dependency
none (vanilla + native APIs)
Tag
Flow
Best for
Long editorial pages: restaurants (one plate/room band), salons, remodelers, landscapers

What it does

Three CSS-only pieces on animation-timeline: .wbl-progress scales with scroll(root); .wbl-par clips a photo that drifts ±7% across its view() (scaled 1.18 so no edge ever shows); [data-sd=fade] rises from 25% opacity during the first 70% of its entry, so nothing is ever blank or stuck. Where scroll timelines are missing, module.js drives the bar and parallax with one passive rAF handler limited to visible frames; fade-ups simply show.

When to use

Don't

Reduced motion, no JS, accessibility

Notes

Copy-ready snippet

<!-- Scroll scenes (CSS scroll-driven) (WBL Code Library) -->
<!-- in <head>: -->
<script>document.documentElement.classList.add('wbl-js')</script>
<link rel="stylesheet" href="/wbl/scroll-scenes/module.css">
<script src="/wbl/scroll-scenes/module.js" defer></script>

<!-- markup: -->
<!-- reading progress bar (once per page, right after <body>) -->
<div class="wbl-progress" aria-hidden="true"></div>

<!-- parallax band: the frame clips, the photo drifts ±7% -->
<figure class="wbl-par" style="aspect-ratio:21/9;margin:0">
  <img src="../_demo/img/salon-interior.jpg" width="1400" height="935" alt="The studio floor in afternoon light" loading="lazy">
</figure>

<!-- soft fade-up as it enters (content is never hidden: it starts at 25% and finishes by 70% of its entry) -->
<div data-sd="fade">…</div>

README.md · module.js · module.css · All modules