Scrollytelling Sections in HTML, CSS and React

Updated 2026-10-16. 8 effects.

Scrollytelling pins one visual, such as a photo, map, chart or product, while short blocks of text scroll past beside it, and each block changes what the visual shows. Build it with position: sticky for the pinned side and an IntersectionObserver that marks the active step. Every story below works that way, in HTML or React.

A story section earns its height only when the picture really changes from step to step: a chart gains a line, a route grows across a map, a product turns to show another side, a photo crops to the detail the text is describing. If the visual would stay the same, a plain list of cards reads faster.

Keep each step to a sentence or two, and keep the steps in normal reading order in the HTML. The pinned visual is decoration for sighted readers; the text has to carry the whole story on its own, which is also what people with reduced motion and screen readers get.

Pinned panels that crossfade on scroll and stacking cards are related effects with their own pages; this collection is for sections where text drives a single changing scene.

Compare them

EffectBuilt withSize (gzipped)Running costBrowser support
Area Chart Gains Data Per StepCSS and a small script4.8 KBThe second year rises with a scaleY transform and the rest fade with opacity; no path is redrawn while scrolling.All current browsers
Floor Plan Lights Each RoomCSS and a small script4.3 KBFive gradient rectangles fade with opacity; nothing else on the plan changes while scrolling.All current browsers
Highlighter Moves Down A Recipe CardCSS and a small script4.3 KBOne highlight bar moves with translate and scale; the card itself is static text and never re-lays out.All current browsers
Jacket Layers Separate On ScrollCSS and a small script4.1 KBThree flat plates move with translate and fade with opacity; the tilt is a fixed transform that never changes.All current browsers
Photo Zooms To Each DetailCSS and a small script4 KBOnly a transform on one image changes, so each zoom runs on the compositor; the photo is loaded once at 1600px wide.All current browsers
Sun Crosses The Sky Through A DayCSS and a small script4.3 KBFour stacked gradient layers fade with opacity and two elements move with transform; the scene uses no images.All current browsers
Walking Route Grows Across Pinned MapCSS and a small script4.6 KBOne IntersectionObserver swaps a data attribute; the pan and pin are transform transitions on one small SVG.All current browsers
Year Of Weeks Fills By SeasonCSS and a small script4.2 KBFifty-two small squares fade and scale in with CSS transitions, only when their season's step becomes active.All current browsers

Area Chart Gains Data Per Step

A solar co-op tells a two-year story with one pinned area chart. The first year is already drawn, the next step raises the second year from the baseline, then a highlighted band and a target line arrive as the text reaches them. Fits annual reports, impact pages and any data story with a clear before and after.

<section class="w1cht" data-w1cht data-step="1" tabindex="0" aria-label="Saltmarsh Solar output story, scrollable">
  <div class="w1cht-hint" aria-hidden="true"><span>Scroll inside</span></div>
  <div class="w1cht-grid">
    <div class="w1cht-vis">
      <div class="w1cht-frame" role="img" aria-label="Area chart of monthly output in megawatt hours. In 2024 output peaks at 32 in July. In 2025, after the school roof array went live in June, output peaks at 52 in July. A dashed target line sits at 40 for summer months.">
        <svg class="w1cht-svg" viewBox="0 0 480 320" aria-hidden="true">
          <g font-size="11" font-family="ui-sans-serif, system-ui, sans-serif" fill="#5b6576">
            <g stroke="#e6e9ee" stroke-width="1" text-anchor="end"><line x1="56" x2="456" y1="270" y2="270"></line><text x="44" y="274">0</text><line x1="56" x2="456" y1="230" y2="230"></line><text x="44" y="234">10</text><line x1="56" x2="456" y1="190" y2="190"></line><text x="44" y="194">20</text><line x1="56" x2="456" y1="150" y2="150"></line><text x="44" y="154">30</text><line x1="56" x2="456" y1="110" y2="110"></line><text x="44" y="114">40</text><line x1="56" x2="456" y1="70" y2="70"></line><text x="44" y="74">50</text></g>
            <g text-anchor="middle"><text x="56" y="290">J</text><text x="92.4" y="290">F</text><text x="128.7" y="290">M</text><text x="165.1" y="290">A</text><text x="201.5" y="290">M</text><text x="237.8" y="290">J</text><text x="274.2" y="290">J</text><text x="310.5" y="290">A</text><text x="346.9" y="290">S</text><text x="383.3" y="290">O</text><text x="419.6" y="290">N</text><text x="456" y="290">D</text></g>
            <text x="56" y="18" fill="#17202b" font-weight="700">MWh per month</text>
          </g>
          <rect class="w1cht-band" x="221.8" y="30" width="104.69999999999999" height="240" fill="#b45309" fill-opacity=".09"></rect>
          <g class="w1cht-y1">
            <path d="M56 238 L92.4 226 L128.7 202 L165.1 178 L201.5 158 L237.8 146 L274.2 142 L310.5 158 L346.9 186 L383.3 214 L419.6 234 L456 242 L456 270 L56 270Z" fill="#8592a6" fill-opacity=".16"></path>
            <path d="M56 238 L92.4 226 L128.7 202 L165.1 178 L201.5 158 L237.8 146 L274.2 142 L310.5 158 L346.9 186 L383.3 214 L419.6 234 L456 242" fill="none" stroke="#7d8a9e" stroke-width="2.5" stroke-linejoin="round"></path>
            <g fill="#fff" stroke="#7d8a9e" stroke-width="2"><circle cx="56" cy="238" r="3"></circle><circle cx="92.4" cy="226" r="3"></circle><circle cx="128.7" cy="202" r="3"></circle><circle cx="165.1" cy="178" r="3"></circle><circle cx="201.5" cy="158" r="3"></circle><circle cx="237.8" cy="146" r="3"></circle><circle cx="274.2" cy="142" r="3"></circle><circle cx="310.5" cy="158" r="3"></circle><circle cx="346.9" cy="186" r="3"></circle><circle cx="383.3" cy="214" r="3"></circle><circle cx="419.6" cy="234" r="3"></circle><circle cx="456" cy="242" r="3"></circle></g>
          </g>
          <g class="w1cht-y2">
            <path d="M56 234 L92.4 222 L128.7 198 L165.1 170 L201.5 150 L237.8 82 L274.2 62 L310.5 86 L346.9 134 L383.3 182 L419.6 214 L456 226 L456 270 L56 270Z" fill="#0d6b62" fill-opacity=".18"></path>
            <path d="M56 234 L92.4 222 L128.7 198 L165.1 170 L201.5 150 L237.8 82 L274.2 62 L310.5 86 L346.9 134 L383.3 182 L419.6 214 L456 226" fill="none" stroke="#0d6b62" stroke-width="3" stroke-linejoin="round"></path>
            <g fill="#fff" stroke="#0d6b62" stroke-width="2"><circle cx="56" cy="234" r="3"></circle><circle cx="92.4" cy="222" r="3"></circle><circle cx="128.7" cy="198" r="3"></circle><circle cx="165.1" cy="170" r="3"></circle><circle cx="201.5" cy="150" r="3"></circle><circle cx="237.8" cy="82" r="3"></circle><circle cx="274.2" cy="62" r="3"></circle><circle cx="310.5" cy="86" r="3"></circle><circle cx="346.9" cy="134" r="3"></circle><circle cx="383.3" cy="182" r="3"></circle><circle cx="419.6" cy="214" r="3"></circle><circle cx="456" cy="226" r="3"></circle></g>
          </g>
          <g class="w1cht-note" font-family="ui-sans-serif, system-ui, sans-serif">
            <text x="274.2" y="36" text-anchor="middle" font-size="12" font-weight="700" fill="#8a3f07">School roof live</text>
            <text x="274.2" y="50" text-anchor="middle" font-size="11" fill="#5b4a3a">June to August</text>
          </g>
          <g class="w1cht-goal">
            <line x1="56" x2="456" y1="110" y2="110" stroke="#b45309" stroke-width="1.6" stroke-dasharray="5 5"></line>
            <rect x="352" y="84" width="104" height="20" rx="4" fill="#b45309"></rect>
            <text x="404" y="98" text-anchor="middle" font-size="11" font-weight="700" fill="#fff" font-family="ui-sans-serif, system-ui, sans-serif">2026 target, 40</text>
          </g>
        </svg>
        <ul class="w1cht-key" aria-hidden="true"><li class="w1cht-k1">2024</li><li class="w1cht-k2">2025</li></ul>
      </div>
    </div>
    <div class="w1cht-col">
      <header class="w1cht-head" data-i="1"><p class="w1cht-eyebrow">Saltmarsh Solar Co-op</p><h2 class="w1cht-h">What one new roof did for our output</h2><p class="w1cht-lede">Members asked whether the school roof array was worth it. Here is a year of meter readings, added a layer at a time.</p></header>
      <ol class="w1cht-steps">
      <li class="w1cht-step" data-i="1"><div class="w1cht-card"><p class="w1cht-when">2024</p><h3>A normal year on the barn roofs</h3><p>Our first full year with the barn arrays alone. Output follows the sun, topping out at 32 megawatt hours in July.</p></div></li>
      <li class="w1cht-step" data-i="2"><div class="w1cht-card"><p class="w1cht-when">2025</p><h3>The second year rises above it</h3><p>The same months a year later. Spring tracks 2024 closely, then the summer line pulls well clear of the old one.</p></div></li>
      <li class="w1cht-step" data-i="3"><div class="w1cht-card"><p class="w1cht-when">June to August</p><h3>The school roof is the difference</h3><p>The new array on the primary school went live in the first week of June, and almost all of the extra output lands in these three months.</p></div></li>
      <li class="w1cht-step" data-i="4"><div class="w1cht-card"><p class="w1cht-when">Next year</p><h3>A target members voted for</h3><p>At the spring meeting members set a goal of 40 megawatt hours in every summer month, which 2025 already cleared.</p></div></li>
      </ol>
    </div>
  </div>
  <div class="w1cht-end"><p>Members get the full meter readings every quarter.</p><a href="#" class="w1cht-btn">Become a member</a></div>
</section>

<style>
  /* Change these: the colours below, --w1cht-box (box height), and the two data arrays in the SVG paths and the .w1cht-goal line position. */
  .w1cht { --w1cht-bg: #f6f7f9; --w1cht-ink: #17202b; --w1cht-soft: #475365; --w1cht-accent: #0d6b62; --w1cht-btnink: #fff; --w1cht-card: #ffffff;
    --w1cht-line: #dde2e8; --w1cht-panel: #ffffff; --w1cht-chip: rgba(23,32,43,.88); --w1cht-chipink: #f6f7f9;
    --w1cht-display: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --w1cht-dw: 680; --w1cht-r: 12px; }
  .w1cht { --w1cht-box: 640px; height: var(--w1cht-box); overflow-y: auto; overflow-x: hidden; position: relative;
    background: var(--w1cht-bg); color: var(--w1cht-ink); font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; scrollbar-width: thin; }
  /* On a normal page: delete height and overflow above, set --w1cht-box: 100vh, and in the script use root: null. */
  .w1cht:focus-visible { outline: 3px solid var(--w1cht-accent); outline-offset: -3px; }
  .w1cht-hint { position: sticky; top: 0; height: 0; z-index: 5; display: flex; align-items: flex-start; justify-content: flex-end; pointer-events: none; }
  .w1cht-hint span { margin: 12px 12px 0 0; padding: 5px 12px; border-radius: 999px; background: var(--w1cht-chip); color: var(--w1cht-chipink);
    font-size: 12px; letter-spacing: .04em; transition: opacity .5s ease; }
  .w1cht[data-touched] .w1cht-hint span { opacity: 0; }
  .w1cht-grid { max-width: 72rem; margin: 0 auto; padding: 0 32px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 0 56px; }
  .w1cht[data-side="left"] .w1cht-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  .w1cht-vis { grid-column: 2; grid-row: 1; align-self: start; position: sticky; top: 0; z-index: 1; height: var(--w1cht-box);
    box-sizing: border-box; padding: 28px 0; display: flex; align-items: center; justify-content: center; }
  .w1cht[data-side="left"] .w1cht-vis { grid-column: 1; }
  .w1cht[data-side="left"] .w1cht-col { grid-column: 2; }
  .w1cht-frame { position: relative; width: min(100%, calc((var(--w1cht-box) - 56px) * 1.5)); aspect-ratio: 1.5; overflow: hidden;
    border-radius: var(--w1cht-r, 18px); background: var(--w1cht-panel);
    box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 28px 56px -28px rgba(0,0,0,.35); }
  .w1cht-col { grid-column: 1; grid-row: 1; position: relative; z-index: 2; min-width: 0; }
  .w1cht-head { padding: 56px 0 8px; }
  .w1cht-eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--w1cht-accent); }
  .w1cht-h { margin: 12px 0 0; font-family: var(--w1cht-display); font-weight: var(--w1cht-dw, 600); font-size: clamp(1.75rem, 3.6vw, 2.6rem); line-height: 1.1; letter-spacing: -.02em; }
  .w1cht-lede { margin: 14px 0 0; max-width: 30rem; font-size: 1.0625rem; line-height: 1.6; color: var(--w1cht-soft); }
  .w1cht-steps { list-style: none; margin: 0; padding: 0 0 calc(var(--w1cht-box) * .42); }
  .w1cht-step { min-height: calc(var(--w1cht-box) * .62); display: flex; align-items: center; }
  .w1cht-card { box-sizing: border-box; width: 100%; padding: 22px 24px; border-radius: 14px; background: var(--w1cht-card); border: 1px solid var(--w1cht-line);
    opacity: .55; transition: opacity .45s ease; }
  .w1cht[data-step="1"] .w1cht-step[data-i="1"] .w1cht-card,
  .w1cht[data-step="2"] .w1cht-step[data-i="2"] .w1cht-card,
  .w1cht[data-step="3"] .w1cht-step[data-i="3"] .w1cht-card,
  .w1cht[data-step="4"] .w1cht-step[data-i="4"] .w1cht-card { opacity: 1; }
  .w1cht-when { margin: 0; font-size: .8125rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--w1cht-accent); }
  .w1cht-card h3 { margin: 6px 0 0; font-size: 1.375rem; line-height: 1.25; font-weight: 650; }
  .w1cht-card h3 + p { margin: 8px 0 0; font-size: 1rem; line-height: 1.6; color: var(--w1cht-soft); }
  .w1cht-end { max-width: 72rem; margin: 0 auto; padding: 48px 32px 64px; display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; justify-content: space-between; border-top: 1px solid var(--w1cht-line); }
  .w1cht-end p { margin: 0; font-size: 1.0625rem; }
  .w1cht-btn { display: inline-flex; min-height: 46px; align-items: center; padding: 0 22px; border-radius: 999px; background: var(--w1cht-accent);
    color: var(--w1cht-btnink); font-weight: 600; font-size: .9375rem; text-decoration: none; transition: transform .2s ease; }
  .w1cht-btn:hover { transform: translateY(-1px); }
  .w1cht-btn:focus-visible { outline: 3px solid var(--w1cht-ink); outline-offset: 3px; }
  /* Phones: the visual pins at the top and the steps scroll up over it on solid cards. */
  @media (max-width: 760px) {
    .w1cht-grid, .w1cht[data-side="left"] .w1cht-grid { grid-template-columns: minmax(0, 1fr); padding: 0 16px; }
    .w1cht-vis, .w1cht[data-side="left"] .w1cht-vis { grid-column: 1; grid-row: 2; height: 270px; padding: 12px 0; background: var(--w1cht-bg); }
    .w1cht-frame { width: min(100%, calc(242px * 1.5)); }
    .w1cht-col, .w1cht[data-side="left"] .w1cht-col { display: contents; }
    .w1cht-head { grid-row: 1; padding: 36px 0 4px; }
    .w1cht-steps { grid-row: 3; position: relative; z-index: 2; }
    .w1cht-step { min-height: calc(var(--w1cht-box) * .5); align-items: flex-end; }
    .w1cht-card { opacity: 1; box-shadow: 0 14px 34px -16px rgba(0,0,0,.4); }
    .w1cht-end { padding: 40px 16px 56px; }
  }
  /* Reduced motion: nothing pins, the steps read as a plain list and the visual shows its final state. */
  @media (prefers-reduced-motion: reduce) {
    .w1cht-vis, .w1cht[data-side="left"] .w1cht-vis { position: relative; height: auto; }
    .w1cht-step { min-height: 0; padding: 8px 0; }
    .w1cht-steps { padding-bottom: 32px; }
    .w1cht .w1cht-card { opacity: 1; }
    .w1cht *, .w1cht *::before { transition: none !important; }
  }
  .w1cht-frame { border: 1px solid var(--w1cht-line); }
  .w1cht-svg { display: block; width: 100%; height: 100%; }
  .w1cht-y2 { transform-box: view-box; transform-origin: 0 270px; transform: scaleY(0); opacity: 0;
    transition: transform 1.1s cubic-bezier(.3,.7,.2,1), opacity .4s ease; }
  .w1cht-band, .w1cht-note, .w1cht-goal { opacity: 0; transition: opacity .6s ease; }
  .w1cht-note { transform: translateY(8px); transition: opacity .5s ease .2s, transform .6s ease .2s; }
  .w1cht-goal { transform: translateX(-24px); transition: opacity .5s ease, transform .8s cubic-bezier(.3,.7,.2,1); }
  .w1cht-y1 { transition: opacity .6s ease; }
  .w1cht:not([data-step="1"]) .w1cht-y2 { transform: none; opacity: 1; }
  .w1cht[data-step="2"] .w1cht-y1 { opacity: .55; }
  .w1cht[data-step="3"] .w1cht-band, .w1cht[data-step="3"] .w1cht-note, .w1cht[data-step="4"] .w1cht-band,
  .w1cht[data-step="4"] .w1cht-note, .w1cht[data-step="4"] .w1cht-goal { opacity: 1; transform: none; }
  .w1cht-key { position: absolute; right: 14px; top: 10px; margin: 0; padding: 0; list-style: none; display: flex; gap: 12px; font-size: 12px; font-weight: 600; color: var(--w1cht-soft); }
  .w1cht-key li::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: #7d8a9e; vertical-align: -1px; }
  .w1cht-key .w1cht-k2 { opacity: .35; transition: opacity .4s ease; }
  .w1cht-key .w1cht-k2::before { background: #0d6b62; }
  .w1cht:not([data-step="1"]) .w1cht-k2 { opacity: 1; }
</style>

<script>
(function () {
  var root = document.querySelector("[data-w1cht]");
  if (!root) return;
  var off = []; // cleanup list, used by the React version
  var SPEED = 100; // demo scroll in px per second until someone touches the box; 0 turns it off
  var MID = "-48% 0px -48% 0px"; // a step becomes active when it crosses the middle of the box
  var reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
  var steps = root.querySelectorAll("[data-i]"), lastStep = steps[steps.length - 1].getAttribute("data-i");
  function on(el, n, f) { el.addEventListener(n, f, { passive: true }); off.push(function () { el.removeEventListener(n, f); }); }
  function set(i) {
    if (root.getAttribute("data-step") === i) return;
    root.setAttribute("data-step", i);
  }
  if (reduce) set(lastStep);
  else {
    // Which step is active: one observer on the nearest scroller. For a section on a normal page use root: null.
    var io = new IntersectionObserver(function (es) {
      es.forEach(function (e) { if (e.isIntersecting) set(e.target.getAttribute("data-i")); });
    }, { root: root, rootMargin: MID });
    steps.forEach(function (s) { io.observe(s); });
    off.push(function () { io.disconnect(); });
    // Slow demo scroll so the preview moves; any wheel, touch, click or key hands control back.
    var frame = 0, t0 = 0, pos = 0, seen = true, done = !SPEED;
    var tick = function (t) {
      pos += t0 ? SPEED * Math.min(t - t0, 50) / 1000 : 0;
      t0 = t;
      if (pos >= root.scrollHeight - root.clientHeight) pos = 0;
      root.scrollTop = pos;
      frame = requestAnimationFrame(tick);
    };
    var play = function () { if (!done && seen && !frame) { t0 = 0; frame = requestAnimationFrame(tick); } };
    var stop = function () { cancelAnimationFrame(frame); frame = 0; };
    off.push(stop);
    var vis = new IntersectionObserver(function (e) { seen = e[0].isIntersecting; if (seen) play(); else stop(); });
    vis.observe(root);
    off.push(function () { vis.disconnect(); });
    ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (n) {
      on(root, n, function () { done = true; stop(); root.setAttribute("data-touched", ""); });
    });
    play();
  }
})();
</script>

With reduced motion: The chart shows both years, the summer band and the target line together, next to the four steps as a list.

Running cost: The second year rises with a scaleY transform and the rest fade with opacity; no path is redrawn while scrolling.

  • Replace the data in the `area()` and `line()` paths; y is `270 - value * 4` and x steps evenly across 400 units.
  • Move the target by changing the `y1` and `y2` of the line inside `.w1cht-goal`.
  • Change the rise speed with the `1.1s` transition on `.w1cht-y2`.

Floor Plan Lights Each Room

A holiday cottage tour where a pinned floor plan lights one room per step. The room being described glows warm, rooms already visited stay softly lit, and the rest wait in the dark. Good for rentals, venues, show homes and office moves where people want to picture the layout before they arrive.

<section class="w1pln" data-w1pln data-step="1" tabindex="0" aria-label="A tour of Larkspur Cottage, scrollable">
  <div class="w1pln-hint" aria-hidden="true"><span>Scroll inside</span></div>
  <div class="w1pln-grid">
    <div class="w1pln-vis">
      <div class="w1pln-frame" role="img" aria-label="Floor plan of Larkspur Cottage: a kitchen in the top left, a living room across the top right, a bedroom in the bottom left, then a bathroom and a garden room along the bottom right.">
        <svg class="w1pln-svg" viewBox="0 0 400 300" aria-hidden="true">
          <defs><radialGradient id="w1pln-glow" cx="50%" cy="45%" r="70%"><stop offset="0" stop-color="#f6c97a" stop-opacity=".95"></stop><stop offset=".55" stop-color="#d7953f" stop-opacity=".45"></stop><stop offset="1" stop-color="#d7953f" stop-opacity=".08"></stop></radialGradient></defs>
          <rect x="20" y="20" width="360" height="260" fill="#111c30"></rect>
          <rect class="w1pln-lit w1pln-r1" x="20" y="20" width="150" height="120" fill="url(#w1pln-glow)"></rect>
          <rect class="w1pln-lit w1pln-r2" x="170" y="20" width="210" height="150" fill="url(#w1pln-glow)"></rect>
          <rect class="w1pln-lit w1pln-r3" x="20" y="140" width="180" height="140" fill="url(#w1pln-glow)"></rect>
          <rect class="w1pln-lit w1pln-r4" x="200" y="170" width="90" height="110" fill="url(#w1pln-glow)"></rect>
          <rect class="w1pln-lit w1pln-r5" x="290" y="170" width="90" height="110" fill="url(#w1pln-glow)"></rect>
          <g fill="none" stroke="#5c6f8f" stroke-width="1.5">
            <rect x="34" y="34" width="122" height="22" rx="2"></rect><circle cx="132" cy="102" r="16"></circle>
            <rect x="196" y="40" width="96" height="34" rx="8"></rect><rect x="300" y="96" width="60" height="40" rx="3"></rect>
            <rect x="40" y="170" width="76" height="92" rx="4"></rect><rect x="46" y="176" width="64" height="18" rx="3"></rect>
            <rect x="214" y="186" width="34" height="62" rx="12"></rect><rect x="304" y="186" width="62" height="40" rx="3"></rect>
          </g>
          <g stroke="#cdd6e5" stroke-width="5" fill="none" stroke-linecap="square">
            <rect x="20" y="20" width="360" height="260"></rect>
            <path d="M170 20 V70 M170 104 V140 M20 140 H120 M154 140 H200 M200 140 V280 M200 170 H230 M262 170 H380 M290 170 V212 M290 246 V280"></path>
          </g>
          <g font-size="11" font-weight="600" text-anchor="middle" fill="#e9eef6" font-family="ui-sans-serif, system-ui, sans-serif" letter-spacing=".04em"><text x="95" y="126">Kitchen</text><text x="275" y="156">Living room</text><text x="110" y="266">Bedroom</text><text x="245" y="266">Bath</text><text x="335" y="266">Garden room</text></g>
        </svg>
      </div>
    </div>
    <div class="w1pln-col">
      <header class="w1pln-head" data-i="1"><p class="w1pln-eyebrow">Larkspur Cottage, sleeps two</p><h2 class="w1pln-h">Walk through the cottage before you arrive</h2><p class="w1pln-lede">A small stone cottage at the end of a farm lane. Scroll and the lights come on room by room.</p></header>
      <ol class="w1pln-steps">
      <li class="w1pln-step" data-i="1"><div class="w1pln-card"><p class="w1pln-when">Kitchen</p><h3>A table by the window</h3><p>A round oak table for two, a range cooker and a dresser stocked with the basics. Mornings bring sun straight through the east window.</p></div></li>
      <li class="w1pln-step" data-i="2"><div class="w1pln-card"><p class="w1pln-when">Living room</p><h3>The wood burner and the long sofa</h3><p>The biggest room, with a stove that heats the whole cottage and a deep window seat looking up the valley.</p></div></li>
      <li class="w1pln-step" data-i="3"><div class="w1pln-card"><p class="w1pln-when">Bedroom</p><h3>A king-size bed under the eaves</h3><p>Linen sheets, blackout curtains and thick stone walls, so it stays quiet even when the farm starts early.</p></div></li>
      <li class="w1pln-step" data-i="4"><div class="w1pln-card"><p class="w1pln-when">Bathroom</p><h3>A deep bath, not a shower tray</h3><p>A cast iron tub with a hand shower, heated towel rail and a skylight above it.</p></div></li>
      <li class="w1pln-step" data-i="5"><div class="w1pln-card"><p class="w1pln-when">Garden room</p><h3>Breakfast looking at the hills</h3><p>Glazed on two sides and opening onto a small walled garden with a bench and a fire pit.</p></div></li>
      </ol>
    </div>
  </div>
  <div class="w1pln-end"><p>Three night minimum, dogs welcome by arrangement.</p><a href="#" class="w1pln-btn">Check dates</a></div>
</section>

<style>
  /* Change these: the colours below, --w1pln-box (box height), and the room rectangles in the SVG and the glow colour in #w1pln-glow. */
  .w1pln { --w1pln-bg: #0e1726; --w1pln-ink: #e9eef6; --w1pln-soft: #b3bfd1; --w1pln-accent: #e8b766; --w1pln-btnink: #1b1407; --w1pln-card: #142035;
    --w1pln-line: #26375a; --w1pln-panel: #0b1322; --w1pln-chip: rgba(232,183,102,.94); --w1pln-chipink: #1b1407;
    --w1pln-display: Georgia, "Iowan Old Style", serif; --w1pln-dw: 400; --w1pln-r: 14px; }
  .w1pln { --w1pln-box: 640px; height: var(--w1pln-box); overflow-y: auto; overflow-x: hidden; position: relative;
    background: var(--w1pln-bg); color: var(--w1pln-ink); font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; scrollbar-width: thin; }
  /* On a normal page: delete height and overflow above, set --w1pln-box: 100vh, and in the script use root: null. */
  .w1pln:focus-visible { outline: 3px solid var(--w1pln-accent); outline-offset: -3px; }
  .w1pln-hint { position: sticky; top: 0; height: 0; z-index: 5; display: flex; align-items: flex-start; justify-content: flex-end; pointer-events: none; }
  .w1pln-hint span { margin: 12px 12px 0 0; padding: 5px 12px; border-radius: 999px; background: var(--w1pln-chip); color: var(--w1pln-chipink);
    font-size: 12px; letter-spacing: .04em; transition: opacity .5s ease; }
  .w1pln[data-touched] .w1pln-hint span { opacity: 0; }
  .w1pln-grid { max-width: 72rem; margin: 0 auto; padding: 0 32px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 0 56px; }
  .w1pln[data-side="left"] .w1pln-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  .w1pln-vis { grid-column: 2; grid-row: 1; align-self: start; position: sticky; top: 0; z-index: 1; height: var(--w1pln-box);
    box-sizing: border-box; padding: 28px 0; display: flex; align-items: center; justify-content: center; }
  .w1pln[data-side="left"] .w1pln-vis { grid-column: 1; }
  .w1pln[data-side="left"] .w1pln-col { grid-column: 2; }
  .w1pln-frame { position: relative; width: min(100%, calc((var(--w1pln-box) - 56px) * 1.3333)); aspect-ratio: 1.3333; overflow: hidden;
    border-radius: var(--w1pln-r, 18px); background: var(--w1pln-panel);
    box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 28px 56px -28px rgba(0,0,0,.35); }
  .w1pln-col { grid-column: 1; grid-row: 1; position: relative; z-index: 2; min-width: 0; }
  .w1pln-head { padding: 56px 0 8px; }
  .w1pln-eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--w1pln-accent); }
  .w1pln-h { margin: 12px 0 0; font-family: var(--w1pln-display); font-weight: var(--w1pln-dw, 600); font-size: clamp(1.75rem, 3.6vw, 2.6rem); line-height: 1.1; letter-spacing: -.02em; }
  .w1pln-lede { margin: 14px 0 0; max-width: 30rem; font-size: 1.0625rem; line-height: 1.6; color: var(--w1pln-soft); }
  .w1pln-steps { list-style: none; margin: 0; padding: 0 0 calc(var(--w1pln-box) * .42); }
  .w1pln-step { min-height: calc(var(--w1pln-box) * .62); display: flex; align-items: center; }
  .w1pln-card { box-sizing: border-box; width: 100%; padding: 22px 24px; border-radius: 14px; background: var(--w1pln-card); border: 1px solid var(--w1pln-line);
    opacity: .55; transition: opacity .45s ease; }
  .w1pln[data-step="1"] .w1pln-step[data-i="1"] .w1pln-card,
  .w1pln[data-step="2"] .w1pln-step[data-i="2"] .w1pln-card,
  .w1pln[data-step="3"] .w1pln-step[data-i="3"] .w1pln-card,
  .w1pln[data-step="4"] .w1pln-step[data-i="4"] .w1pln-card,
  .w1pln[data-step="5"] .w1pln-step[data-i="5"] .w1pln-card { opacity: 1; }
  .w1pln-when { margin: 0; font-size: .8125rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--w1pln-accent); }
  .w1pln-card h3 { margin: 6px 0 0; font-size: 1.375rem; line-height: 1.25; font-weight: 650; }
  .w1pln-card h3 + p { margin: 8px 0 0; font-size: 1rem; line-height: 1.6; color: var(--w1pln-soft); }
  .w1pln-end { max-width: 72rem; margin: 0 auto; padding: 48px 32px 64px; display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; justify-content: space-between; border-top: 1px solid var(--w1pln-line); }
  .w1pln-end p { margin: 0; font-size: 1.0625rem; }
  .w1pln-btn { display: inline-flex; min-height: 46px; align-items: center; padding: 0 22px; border-radius: 999px; background: var(--w1pln-accent);
    color: var(--w1pln-btnink); font-weight: 600; font-size: .9375rem; text-decoration: none; transition: transform .2s ease; }
  .w1pln-btn:hover { transform: translateY(-1px); }
  .w1pln-btn:focus-visible { outline: 3px solid var(--w1pln-ink); outline-offset: 3px; }
  /* Phones: the visual pins at the top and the steps scroll up over it on solid cards. */
  @media (max-width: 760px) {
    .w1pln-grid, .w1pln[data-side="left"] .w1pln-grid { grid-template-columns: minmax(0, 1fr); padding: 0 16px; }
    .w1pln-vis, .w1pln[data-side="left"] .w1pln-vis { grid-column: 1; grid-row: 2; height: 290px; padding: 12px 0; background: var(--w1pln-bg); }
    .w1pln-frame { width: min(100%, calc(262px * 1.3333)); }
    .w1pln-col, .w1pln[data-side="left"] .w1pln-col { display: contents; }
    .w1pln-head { grid-row: 1; padding: 36px 0 4px; }
    .w1pln-steps { grid-row: 3; position: relative; z-index: 2; }
    .w1pln-step { min-height: calc(var(--w1pln-box) * .5); align-items: flex-end; }
    .w1pln-card { opacity: 1; box-shadow: 0 14px 34px -16px rgba(0,0,0,.4); }
    .w1pln-end { padding: 40px 16px 56px; }
  }
  /* Reduced motion: nothing pins, the steps read as a plain list and the visual shows its final state. */
  @media (prefers-reduced-motion: reduce) {
    .w1pln-vis, .w1pln[data-side="left"] .w1pln-vis { position: relative; height: auto; }
    .w1pln-step { min-height: 0; padding: 8px 0; }
    .w1pln-steps { padding-bottom: 32px; }
    .w1pln .w1pln-card { opacity: 1; }
    .w1pln *, .w1pln *::before { transition: none !important; }
  }
  .w1pln-frame { border: 1px solid var(--w1pln-line); }
  .w1pln-svg { display: block; width: 100%; height: 100%; }
  .w1pln-lit { opacity: 0; transition: opacity .9s ease; }
  .w1pln[data-step="1"] .w1pln-r1, .w1pln[data-step="2"] .w1pln-r2, .w1pln[data-step="3"] .w1pln-r3,
  .w1pln[data-step="4"] .w1pln-r4, .w1pln[data-step="5"] .w1pln-r5 { opacity: 1; }
  .w1pln[data-step="2"] .w1pln-r1, .w1pln[data-step="3"] .w1pln-r1, .w1pln[data-step="3"] .w1pln-r2,
  .w1pln[data-step="4"] .w1pln-r1, .w1pln[data-step="4"] .w1pln-r2, .w1pln[data-step="4"] .w1pln-r3,
  .w1pln[data-step="5"] .w1pln-r1, .w1pln[data-step="5"] .w1pln-r2, .w1pln[data-step="5"] .w1pln-r3, .w1pln[data-step="5"] .w1pln-r4 { opacity: .22; }
  @media (prefers-reduced-motion: reduce) { .w1pln .w1pln-lit { opacity: .8; } }
</style>

<script>
(function () {
  var root = document.querySelector("[data-w1pln]");
  if (!root) return;
  var off = []; // cleanup list, used by the React version
  var SPEED = 100; // demo scroll in px per second until someone touches the box; 0 turns it off
  var MID = "-48% 0px -48% 0px"; // a step becomes active when it crosses the middle of the box
  var reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
  var steps = root.querySelectorAll("[data-i]"), lastStep = steps[steps.length - 1].getAttribute("data-i");
  function on(el, n, f) { el.addEventListener(n, f, { passive: true }); off.push(function () { el.removeEventListener(n, f); }); }
  function set(i) {
    if (root.getAttribute("data-step") === i) return;
    root.setAttribute("data-step", i);
  }
  if (reduce) set(lastStep);
  else {
    // Which step is active: one observer on the nearest scroller. For a section on a normal page use root: null.
    var io = new IntersectionObserver(function (es) {
      es.forEach(function (e) { if (e.isIntersecting) set(e.target.getAttribute("data-i")); });
    }, { root: root, rootMargin: MID });
    steps.forEach(function (s) { io.observe(s); });
    off.push(function () { io.disconnect(); });
    // Slow demo scroll so the preview moves; any wheel, touch, click or key hands control back.
    var frame = 0, t0 = 0, pos = 0, seen = true, done = !SPEED;
    var tick = function (t) {
      pos += t0 ? SPEED * Math.min(t - t0, 50) / 1000 : 0;
      t0 = t;
      if (pos >= root.scrollHeight - root.clientHeight) pos = 0;
      root.scrollTop = pos;
      frame = requestAnimationFrame(tick);
    };
    var play = function () { if (!done && seen && !frame) { t0 = 0; frame = requestAnimationFrame(tick); } };
    var stop = function () { cancelAnimationFrame(frame); frame = 0; };
    off.push(stop);
    var vis = new IntersectionObserver(function (e) { seen = e[0].isIntersecting; if (seen) play(); else stop(); });
    vis.observe(root);
    off.push(function () { vis.disconnect(); });
    ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (n) {
      on(root, n, function () { done = true; stop(); root.setAttribute("data-touched", ""); });
    });
    play();
  }
})();
</script>

With reduced motion: Every room on the plan is lit at once, and the five room descriptions follow as a plain list.

Running cost: Five gradient rectangles fade with opacity; nothing else on the plan changes while scrolling.

  • Redraw the plan by editing the `rooms` rectangles and the wall `path`; each room's glow uses the same rectangle.
  • Warm or cool the light with the `stop-color` values in `#w1pln-glow`.
  • Change how bright visited rooms stay with the `.22` opacity rule.

Highlighter Moves Down A Recipe Card

A deli walks down a handwritten recipe card one line at a time. The card stays pinned while a soft highlighter bar slides and stretches to cover the lines each step is about, from the dry ingredients to the bake. Suits recipes, contracts, poems, letters and any document where people should read along with commentary.

<section class="w1rec" data-w1rec data-step="1" tabindex="0" aria-label="How we bake Ada's brown soda bread, scrollable">
  <div class="w1rec-hint" aria-hidden="true"><span>Scroll inside</span></div>
  <div class="w1rec-grid">
    <div class="w1rec-vis">
      <div class="w1rec-frame" role="img" aria-label="A handwritten recipe card for Ada's brown soda bread listing wholemeal flour, oats, bicarbonate of soda, salt, buttermilk and black treacle, then mixing, shaping and baking at 200 degrees for 40 minutes.">
        <div class="w1rec-desk" aria-hidden="true">
          <div class="w1rec-card2">
            <p class="w1rec-title">Ada's brown soda bread</p>
            <div class="w1rec-lines">
              <span class="w1rec-mark"></span>
              <p>450 g wholemeal flour</p>
              <p>50 g oats, and a handful for the top</p>
              <p>1 tsp bicarbonate of soda</p>
              <p>1 tsp fine salt</p>
              <p>400 ml buttermilk</p>
              <p>1 tbsp black treacle</p>
              <p>Dry first, then wet, with a fork. No kneading.</p>
              <p>Shape a round, cut a deep cross.</p>
              <p>200&#176;C for 40 min, till it sounds hollow.</p>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="w1rec-col">
      <header class="w1rec-head" data-i="1"><p class="w1rec-eyebrow">Pellow &amp; Daughter Deli</p><h2 class="w1rec-h">The bread card we bake from every morning</h2><p class="w1rec-lede">Ada wrote this out in 1974 and we still follow it to the letter. Scroll and we will walk you down her card.</p></header>
      <ol class="w1rec-steps">
      <li class="w1rec-step" data-i="1"><div class="w1rec-card"><p class="w1rec-when">Lines one to four</p><h3>The dry things, in one bowl</h3><p>Coarse wholemeal, oats, soda and salt, whisked so the soda is spread evenly. Lumps of soda taste bitter, which is why she underlined it.</p></div></li>
      <li class="w1rec-step" data-i="2"><div class="w1rec-card"><p class="w1rec-when">Lines five and six</p><h3>Buttermilk and a spoon of treacle</h3><p>Warm the treacle a little so it slides off the spoon, then stir it into the buttermilk before it goes near the flour.</p></div></li>
      <li class="w1rec-step" data-i="3"><div class="w1rec-card"><p class="w1rec-when">Line seven</p><h3>A fork, not your hands</h3><p>Pour the wet into a well in the dry and bring it together with a fork. It should look shaggy. Working it more makes the loaf tough.</p></div></li>
      <li class="w1rec-step" data-i="4"><div class="w1rec-card"><p class="w1rec-when">Line eight</p><h3>A round with a deep cross</h3><p>Tip it onto a floured tray, pat it into a low dome and cut a cross almost to the bottom so the middle cooks through.</p></div></li>
      <li class="w1rec-step" data-i="5"><div class="w1rec-card"><p class="w1rec-when">Line nine</p><h3>Bake until it sounds hollow</h3><p>Forty minutes in a hot oven, then turn it over and knock on the base. A hollow sound means done; a dull one means five more minutes.</p></div></li>
      </ol>
    </div>
  </div>
  <div class="w1rec-end"><p>Fresh loaves from seven, and the card is printed on our bags.</p><a href="#" class="w1rec-btn">Order for Saturday</a></div>
</section>

<style>
  /* Change these: the colours below, --w1rec-box (box height), and the translateY() line offsets and scaleY() line counts on .w1rec-mark for each data-step. */
  .w1rec { --w1rec-bg: #ece4d4; --w1rec-ink: #2a2118; --w1rec-soft: #574838; --w1rec-accent: #2c4777; --w1rec-btnink: #fff; --w1rec-card: #fbf7ee;
    --w1rec-line: #dcd0ba; --w1rec-panel: #e3d8c3; --w1rec-chip: rgba(42,33,24,.86); --w1rec-chipink: #fbf7ee;
    --w1rec-display: Georgia, "Iowan Old Style", serif; --w1rec-dw: 400; --w1rec-r: 8px; --w1rec-lh: 7.4cqi; }
  .w1rec { --w1rec-box: 640px; height: var(--w1rec-box); overflow-y: auto; overflow-x: hidden; position: relative;
    background: var(--w1rec-bg); color: var(--w1rec-ink); font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; scrollbar-width: thin; }
  /* On a normal page: delete height and overflow above, set --w1rec-box: 100vh, and in the script use root: null. */
  .w1rec:focus-visible { outline: 3px solid var(--w1rec-accent); outline-offset: -3px; }
  .w1rec-hint { position: sticky; top: 0; height: 0; z-index: 5; display: flex; align-items: flex-start; justify-content: flex-end; pointer-events: none; }
  .w1rec-hint span { margin: 12px 12px 0 0; padding: 5px 12px; border-radius: 999px; background: var(--w1rec-chip); color: var(--w1rec-chipink);
    font-size: 12px; letter-spacing: .04em; transition: opacity .5s ease; }
  .w1rec[data-touched] .w1rec-hint span { opacity: 0; }
  .w1rec-grid { max-width: 72rem; margin: 0 auto; padding: 0 32px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 0 56px; }
  .w1rec[data-side="left"] .w1rec-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  .w1rec-vis { grid-column: 2; grid-row: 1; align-self: start; position: sticky; top: 0; z-index: 1; height: var(--w1rec-box);
    box-sizing: border-box; padding: 28px 0; display: flex; align-items: center; justify-content: center; }
  .w1rec[data-side="left"] .w1rec-vis { grid-column: 1; }
  .w1rec[data-side="left"] .w1rec-col { grid-column: 2; }
  .w1rec-frame { position: relative; width: min(100%, calc((var(--w1rec-box) - 56px) * 0.95)); aspect-ratio: 0.95; overflow: hidden;
    border-radius: var(--w1rec-r, 18px); background: var(--w1rec-panel);
    box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 28px 56px -28px rgba(0,0,0,.35); }
  .w1rec-col { grid-column: 1; grid-row: 1; position: relative; z-index: 2; min-width: 0; }
  .w1rec-head { padding: 56px 0 8px; }
  .w1rec-eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--w1rec-accent); }
  .w1rec-h { margin: 12px 0 0; font-family: var(--w1rec-display); font-weight: var(--w1rec-dw, 600); font-size: clamp(1.75rem, 3.6vw, 2.6rem); line-height: 1.1; letter-spacing: -.02em; }
  .w1rec-lede { margin: 14px 0 0; max-width: 30rem; font-size: 1.0625rem; line-height: 1.6; color: var(--w1rec-soft); }
  .w1rec-steps { list-style: none; margin: 0; padding: 0 0 calc(var(--w1rec-box) * .42); }
  .w1rec-step { min-height: calc(var(--w1rec-box) * .62); display: flex; align-items: center; }
  .w1rec-card { box-sizing: border-box; width: 100%; padding: 22px 24px; border-radius: 14px; background: var(--w1rec-card); border: 1px solid var(--w1rec-line);
    opacity: .55; transition: opacity .45s ease; }
  .w1rec[data-step="1"] .w1rec-step[data-i="1"] .w1rec-card,
  .w1rec[data-step="2"] .w1rec-step[data-i="2"] .w1rec-card,
  .w1rec[data-step="3"] .w1rec-step[data-i="3"] .w1rec-card,
  .w1rec[data-step="4"] .w1rec-step[data-i="4"] .w1rec-card,
  .w1rec[data-step="5"] .w1rec-step[data-i="5"] .w1rec-card { opacity: 1; }
  .w1rec-when { margin: 0; font-size: .8125rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--w1rec-accent); }
  .w1rec-card h3 { margin: 6px 0 0; font-size: 1.375rem; line-height: 1.25; font-weight: 650; }
  .w1rec-card h3 + p { margin: 8px 0 0; font-size: 1rem; line-height: 1.6; color: var(--w1rec-soft); }
  .w1rec-end { max-width: 72rem; margin: 0 auto; padding: 48px 32px 64px; display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; justify-content: space-between; border-top: 1px solid var(--w1rec-line); }
  .w1rec-end p { margin: 0; font-size: 1.0625rem; }
  .w1rec-btn { display: inline-flex; min-height: 46px; align-items: center; padding: 0 22px; border-radius: 999px; background: var(--w1rec-accent);
    color: var(--w1rec-btnink); font-weight: 600; font-size: .9375rem; text-decoration: none; transition: transform .2s ease; }
  .w1rec-btn:hover { transform: translateY(-1px); }
  .w1rec-btn:focus-visible { outline: 3px solid var(--w1rec-ink); outline-offset: 3px; }
  /* Phones: the visual pins at the top and the steps scroll up over it on solid cards. */
  @media (max-width: 760px) {
    .w1rec-grid, .w1rec[data-side="left"] .w1rec-grid { grid-template-columns: minmax(0, 1fr); padding: 0 16px; }
    .w1rec-vis, .w1rec[data-side="left"] .w1rec-vis { grid-column: 1; grid-row: 2; height: 300px; padding: 12px 0; background: var(--w1rec-bg); }
    .w1rec-frame { width: min(100%, calc(272px * 0.95)); }
    .w1rec-col, .w1rec[data-side="left"] .w1rec-col { display: contents; }
    .w1rec-head { grid-row: 1; padding: 36px 0 4px; }
    .w1rec-steps { grid-row: 3; position: relative; z-index: 2; }
    .w1rec-step { min-height: calc(var(--w1rec-box) * .5); align-items: flex-end; }
    .w1rec-card { opacity: 1; box-shadow: 0 14px 34px -16px rgba(0,0,0,.4); }
    .w1rec-end { padding: 40px 16px 56px; }
  }
  /* Reduced motion: nothing pins, the steps read as a plain list and the visual shows its final state. */
  @media (prefers-reduced-motion: reduce) {
    .w1rec-vis, .w1rec[data-side="left"] .w1rec-vis { position: relative; height: auto; }
    .w1rec-step { min-height: 0; padding: 8px 0; }
    .w1rec-steps { padding-bottom: 32px; }
    .w1rec .w1rec-card { opacity: 1; }
    .w1rec *, .w1rec *::before { transition: none !important; }
  }
  .w1rec-desk { position: absolute; inset: 0; display: grid; place-items: center; container-type: inline-size;
    background: radial-gradient(80% 60% at 40% 30%, #eadfca, #d9ccb3); }
  .w1rec-card2 { width: 84cqi; box-sizing: border-box; padding: 5cqi 6cqi 6cqi; background: #fbf7ee; border-radius: 4px; transform: rotate(-1.6deg);
    box-shadow: 0 1px 1px rgba(0,0,0,.08), 0 18px 34px -16px rgba(60,40,20,.45); color: #2a2a3d; font-family: "Bradley Hand", "Segoe Print", "Comic Neue", Georgia, serif; }
  .w1rec-title { margin: 0 0 2cqi; font-size: 5.4cqi; line-height: 1.2; color: #8a2f1f; }
  .w1rec-lines { position: relative; background: repeating-linear-gradient(transparent 0 calc(var(--w1rec-lh) - 1px), #c9d6e8 calc(var(--w1rec-lh) - 1px) var(--w1rec-lh)); }
  .w1rec-lines p { position: relative; margin: 0; height: var(--w1rec-lh); line-height: calc(var(--w1rec-lh) + .6cqi); font-size: 3.7cqi; white-space: nowrap; }
  .w1rec-mark { position: absolute; left: -1.5cqi; right: -1.5cqi; top: .4cqi; height: calc(var(--w1rec-lh) - .8cqi); border-radius: 3px;
    background: #f2cf55; opacity: .55; transform-origin: 50% 0; transform: scaleY(4.1); transition: transform .8s cubic-bezier(.6,0,.2,1); }
  .w1rec[data-step="2"] .w1rec-mark { transform: translateY(calc(var(--w1rec-lh) * 4)) scaleY(2.05); }
  .w1rec[data-step="3"] .w1rec-mark { transform: translateY(calc(var(--w1rec-lh) * 6)) scaleY(1); }
  .w1rec[data-step="4"] .w1rec-mark { transform: translateY(calc(var(--w1rec-lh) * 7)) scaleY(1); }
  .w1rec[data-step="5"] .w1rec-mark { transform: translateY(calc(var(--w1rec-lh) * 8)) scaleY(1); }
  @media (prefers-reduced-motion: reduce) { .w1rec .w1rec-mark { opacity: 0; } }
</style>

<script>
(function () {
  var root = document.querySelector("[data-w1rec]");
  if (!root) return;
  var off = []; // cleanup list, used by the React version
  var SPEED = 100; // demo scroll in px per second until someone touches the box; 0 turns it off
  var MID = "-48% 0px -48% 0px"; // a step becomes active when it crosses the middle of the box
  var reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
  var steps = root.querySelectorAll("[data-i]"), lastStep = steps[steps.length - 1].getAttribute("data-i");
  function on(el, n, f) { el.addEventListener(n, f, { passive: true }); off.push(function () { el.removeEventListener(n, f); }); }
  function set(i) {
    if (root.getAttribute("data-step") === i) return;
    root.setAttribute("data-step", i);
  }
  if (reduce) set(lastStep);
  else {
    // Which step is active: one observer on the nearest scroller. For a section on a normal page use root: null.
    var io = new IntersectionObserver(function (es) {
      es.forEach(function (e) { if (e.isIntersecting) set(e.target.getAttribute("data-i")); });
    }, { root: root, rootMargin: MID });
    steps.forEach(function (s) { io.observe(s); });
    off.push(function () { io.disconnect(); });
    // Slow demo scroll so the preview moves; any wheel, touch, click or key hands control back.
    var frame = 0, t0 = 0, pos = 0, seen = true, done = !SPEED;
    var tick = function (t) {
      pos += t0 ? SPEED * Math.min(t - t0, 50) / 1000 : 0;
      t0 = t;
      if (pos >= root.scrollHeight - root.clientHeight) pos = 0;
      root.scrollTop = pos;
      frame = requestAnimationFrame(tick);
    };
    var play = function () { if (!done && seen && !frame) { t0 = 0; frame = requestAnimationFrame(tick); } };
    var stop = function () { cancelAnimationFrame(frame); frame = 0; };
    off.push(stop);
    var vis = new IntersectionObserver(function (e) { seen = e[0].isIntersecting; if (seen) play(); else stop(); });
    vis.observe(root);
    off.push(function () { vis.disconnect(); });
    ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (n) {
      on(root, n, function () { done = true; stop(); root.setAttribute("data-touched", ""); });
    });
    play();
  }
})();
</script>

With reduced motion: The highlighter is hidden and the whole card shows plainly beside the five steps as a list.

Running cost: One highlight bar moves with translate and scale; the card itself is static text and never re-lays out.

  • Point a step at other lines with `translateY(calc(var(--w1rec-lh) * n))` and cover more lines with `scaleY()` on `.w1rec-mark`.
  • Change line spacing on the card with `--w1rec-lh`.
  • Swap the highlighter colour with the `background` and `.55` opacity on `.w1rec-mark`.

Jacket Layers Separate On Scroll

An outdoor brand explains a three-layer jacket fabric with an exploded diagram that stays pinned. The layers start pressed together, pull apart when the story begins, and each step lifts one into full strength with its name tag. Suits technical products, mattresses, packaging and anything whose value sits in layers people never see.

<section class="w1lyr" data-w1lyr data-step="1" tabindex="0" aria-label="Inside the Scar Fell shell jacket, scrollable">
  <div class="w1lyr-hint" aria-hidden="true"><span>Scroll inside</span></div>
  <div class="w1lyr-grid">
    <div class="w1lyr-vis">
      <div class="w1lyr-frame" role="img" aria-label="Exploded diagram of a jacket fabric: a rust coloured ripstop face fabric on top, a thin pale membrane in the middle and a grey grid lining underneath.">
        <div class="w1lyr-stage" aria-hidden="true">
          <div class="w1lyr-pl w1lyr-p-face"><div class="w1lyr-plate w1lyr-face"></div><span class="w1lyr-tag">Face fabric</span></div>
          <div class="w1lyr-pl w1lyr-p-mem"><div class="w1lyr-plate w1lyr-mem"></div><span class="w1lyr-tag">Membrane</span></div>
          <div class="w1lyr-pl w1lyr-p-lin"><div class="w1lyr-plate w1lyr-lin"></div><span class="w1lyr-tag">Lining</span></div>
        </div>
      </div>
    </div>
    <div class="w1lyr-col">
      <header class="w1lyr-head" data-i="1"><p class="w1lyr-eyebrow">Bracken Outerwear</p><h2 class="w1lyr-h">Three layers, pulled apart</h2><p class="w1lyr-lede">The Scar Fell shell feels like one fabric. It is really three, bonded together. Scroll to separate them.</p></header>
      <ol class="w1lyr-steps">
      <li class="w1lyr-step" data-i="1"><div class="w1lyr-card"><p class="w1lyr-when">The shell</p><h3>One fabric, as far as you can tell</h3><p>Light enough to roll into a hip pack and stiff enough to keep its shape in a crosswind. The three layers are laminated, so nothing shifts or bunches.</p></div></li>
      <li class="w1lyr-step" data-i="2"><div class="w1lyr-card"><p class="w1lyr-when">Outside</p><h3>A ripstop face that sheds rain</h3><p>Tight nylon with a grid woven in, so a snag on a fence stops at the next line instead of running. The finish makes water bead and roll off.</p></div></li>
      <li class="w1lyr-step" data-i="3"><div class="w1lyr-card"><p class="w1lyr-when">Middle</p><h3>A membrane that breathes</h3><p>A thin film with pores far smaller than a raindrop but large enough for water vapour, so sweat gets out while weather stays out.</p></div></li>
      <li class="w1lyr-step" data-i="4"><div class="w1lyr-card"><p class="w1lyr-when">Inside</p><h3>A lining that does not cling</h3><p>A soft knit printed with a raised grid, which keeps the membrane off damp skin and slides easily over a fleece.</p></div></li>
      </ol>
    </div>
  </div>
  <div class="w1lyr-end"><p>Every seam is taped from the inside so rain cannot creep through the stitching.</p><a href="#" class="w1lyr-btn">Shop the Scar Fell</a></div>
</section>

<style>
  /* Change these: the colours below, --w1lyr-box (box height), and the translateY() gaps for each plate per data-step and the plate colours in .w1lyr-face, .w1lyr-mem, .w1lyr-lin. */
  .w1lyr { --w1lyr-bg: #1c1e21; --w1lyr-ink: #eceae6; --w1lyr-soft: #b6b3ad; --w1lyr-accent: #e0874f; --w1lyr-btnink: #1c1208; --w1lyr-card: #25282c;
    --w1lyr-line: #34383e; --w1lyr-panel: #212428; --w1lyr-chip: rgba(236,234,230,.92); --w1lyr-chipink: #1c1e21;
    --w1lyr-display: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --w1lyr-dw: 700; --w1lyr-r: 10px; }
  .w1lyr { --w1lyr-box: 640px; height: var(--w1lyr-box); overflow-y: auto; overflow-x: hidden; position: relative;
    background: var(--w1lyr-bg); color: var(--w1lyr-ink); font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; scrollbar-width: thin; }
  /* On a normal page: delete height and overflow above, set --w1lyr-box: 100vh, and in the script use root: null. */
  .w1lyr:focus-visible { outline: 3px solid var(--w1lyr-accent); outline-offset: -3px; }
  .w1lyr-hint { position: sticky; top: 0; height: 0; z-index: 5; display: flex; align-items: flex-start; justify-content: flex-end; pointer-events: none; }
  .w1lyr-hint span { margin: 12px 12px 0 0; padding: 5px 12px; border-radius: 999px; background: var(--w1lyr-chip); color: var(--w1lyr-chipink);
    font-size: 12px; letter-spacing: .04em; transition: opacity .5s ease; }
  .w1lyr[data-touched] .w1lyr-hint span { opacity: 0; }
  .w1lyr-grid { max-width: 72rem; margin: 0 auto; padding: 0 32px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 0 56px; }
  .w1lyr[data-side="left"] .w1lyr-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  .w1lyr-vis { grid-column: 2; grid-row: 1; align-self: start; position: sticky; top: 0; z-index: 1; height: var(--w1lyr-box);
    box-sizing: border-box; padding: 28px 0; display: flex; align-items: center; justify-content: center; }
  .w1lyr[data-side="left"] .w1lyr-vis { grid-column: 1; }
  .w1lyr[data-side="left"] .w1lyr-col { grid-column: 2; }
  .w1lyr-frame { position: relative; width: min(100%, calc((var(--w1lyr-box) - 56px) * 1.15)); aspect-ratio: 1.15; overflow: hidden;
    border-radius: var(--w1lyr-r, 18px); background: var(--w1lyr-panel);
    box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 28px 56px -28px rgba(0,0,0,.35); }
  .w1lyr-col { grid-column: 1; grid-row: 1; position: relative; z-index: 2; min-width: 0; }
  .w1lyr-head { padding: 56px 0 8px; }
  .w1lyr-eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--w1lyr-accent); }
  .w1lyr-h { margin: 12px 0 0; font-family: var(--w1lyr-display); font-weight: var(--w1lyr-dw, 600); font-size: clamp(1.75rem, 3.6vw, 2.6rem); line-height: 1.1; letter-spacing: -.02em; }
  .w1lyr-lede { margin: 14px 0 0; max-width: 30rem; font-size: 1.0625rem; line-height: 1.6; color: var(--w1lyr-soft); }
  .w1lyr-steps { list-style: none; margin: 0; padding: 0 0 calc(var(--w1lyr-box) * .42); }
  .w1lyr-step { min-height: calc(var(--w1lyr-box) * .62); display: flex; align-items: center; }
  .w1lyr-card { box-sizing: border-box; width: 100%; padding: 22px 24px; border-radius: 14px; background: var(--w1lyr-card); border: 1px solid var(--w1lyr-line);
    opacity: .55; transition: opacity .45s ease; }
  .w1lyr[data-step="1"] .w1lyr-step[data-i="1"] .w1lyr-card,
  .w1lyr[data-step="2"] .w1lyr-step[data-i="2"] .w1lyr-card,
  .w1lyr[data-step="3"] .w1lyr-step[data-i="3"] .w1lyr-card,
  .w1lyr[data-step="4"] .w1lyr-step[data-i="4"] .w1lyr-card { opacity: 1; }
  .w1lyr-when { margin: 0; font-size: .8125rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--w1lyr-accent); }
  .w1lyr-card h3 { margin: 6px 0 0; font-size: 1.375rem; line-height: 1.25; font-weight: 650; }
  .w1lyr-card h3 + p { margin: 8px 0 0; font-size: 1rem; line-height: 1.6; color: var(--w1lyr-soft); }
  .w1lyr-end { max-width: 72rem; margin: 0 auto; padding: 48px 32px 64px; display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; justify-content: space-between; border-top: 1px solid var(--w1lyr-line); }
  .w1lyr-end p { margin: 0; font-size: 1.0625rem; }
  .w1lyr-btn { display: inline-flex; min-height: 46px; align-items: center; padding: 0 22px; border-radius: 999px; background: var(--w1lyr-accent);
    color: var(--w1lyr-btnink); font-weight: 600; font-size: .9375rem; text-decoration: none; transition: transform .2s ease; }
  .w1lyr-btn:hover { transform: translateY(-1px); }
  .w1lyr-btn:focus-visible { outline: 3px solid var(--w1lyr-ink); outline-offset: 3px; }
  /* Phones: the visual pins at the top and the steps scroll up over it on solid cards. */
  @media (max-width: 760px) {
    .w1lyr-grid, .w1lyr[data-side="left"] .w1lyr-grid { grid-template-columns: minmax(0, 1fr); padding: 0 16px; }
    .w1lyr-vis, .w1lyr[data-side="left"] .w1lyr-vis { grid-column: 1; grid-row: 2; height: 300px; padding: 12px 0; background: var(--w1lyr-bg); }
    .w1lyr-frame { width: min(100%, calc(272px * 1.15)); }
    .w1lyr-col, .w1lyr[data-side="left"] .w1lyr-col { display: contents; }
    .w1lyr-head { grid-row: 1; padding: 36px 0 4px; }
    .w1lyr-steps { grid-row: 3; position: relative; z-index: 2; }
    .w1lyr-step { min-height: calc(var(--w1lyr-box) * .5); align-items: flex-end; }
    .w1lyr-card { opacity: 1; box-shadow: 0 14px 34px -16px rgba(0,0,0,.4); }
    .w1lyr-end { padding: 40px 16px 56px; }
  }
  /* Reduced motion: nothing pins, the steps read as a plain list and the visual shows its final state. */
  @media (prefers-reduced-motion: reduce) {
    .w1lyr-vis, .w1lyr[data-side="left"] .w1lyr-vis { position: relative; height: auto; }
    .w1lyr-step { min-height: 0; padding: 8px 0; }
    .w1lyr-steps { padding-bottom: 32px; }
    .w1lyr .w1lyr-card { opacity: 1; }
    .w1lyr *, .w1lyr *::before { transition: none !important; }
  }
  .w1lyr-frame { background: radial-gradient(90% 70% at 50% 40%, #2b2f34, #1c1e21 75%); border: 1px solid var(--w1lyr-line); }
  .w1lyr-stage { position: absolute; inset: 0; container-type: size; }
  .w1lyr-pl { position: absolute; left: 44%; top: 50%; width: 0; height: 0; transition: transform 1s cubic-bezier(.55,0,.2,1), opacity .5s ease; }
  .w1lyr-plate { position: absolute; width: 42cqmin; height: 42cqmin; left: -21cqmin; top: -21cqmin; border-radius: 10px;
    transform: rotateX(58deg) rotateZ(-45deg); box-shadow: 0 30px 40px -18px rgba(0,0,0,.6); }
  .w1lyr-face { background: repeating-linear-gradient(0deg, rgba(0,0,0,.12) 0 1px, transparent 1px 9px), repeating-linear-gradient(90deg, rgba(0,0,0,.12) 0 1px, transparent 1px 9px), linear-gradient(135deg, #d06b35, #a94b20); }
  .w1lyr-mem { background: linear-gradient(135deg, rgba(230,236,242,.85), rgba(170,184,198,.7)); }
  .w1lyr-lin { background: repeating-linear-gradient(45deg, rgba(255,255,255,.07) 0 2px, transparent 2px 7px), linear-gradient(135deg, #59636e, #3c444d); }
  .w1lyr-tag { position: absolute; left: 25cqmin; top: -10px; white-space: nowrap; padding: 4px 10px; border-radius: 999px; background: var(--w1lyr-chip); color: var(--w1lyr-chipink);
    font-size: 12px; font-weight: 700; opacity: 0; transform: translateX(-8px); transition: opacity .4s ease .3s, transform .5s ease .3s; }
  .w1lyr-p-face { z-index: 3; transform: translateY(-3cqmin); }
  .w1lyr-p-mem { z-index: 2; }
  .w1lyr-p-lin { z-index: 1; transform: translateY(3cqmin); }
  .w1lyr:not([data-step="1"]) .w1lyr-p-face { transform: translateY(-24cqmin); }
  .w1lyr:not([data-step="1"]) .w1lyr-p-lin { transform: translateY(24cqmin); }
  .w1lyr:not([data-step="1"]) .w1lyr-pl { opacity: .35; }
  .w1lyr:not([data-step="1"]) .w1lyr-tag { opacity: 1; transform: none; }
  .w1lyr[data-step="2"] .w1lyr-p-face, .w1lyr[data-step="3"] .w1lyr-p-mem, .w1lyr[data-step="4"] .w1lyr-p-lin { opacity: 1; }
  .w1lyr[data-step="2"] .w1lyr-p-face { transform: translateY(-28cqmin); }
  @media (prefers-reduced-motion: reduce) { .w1lyr .w1lyr-pl { opacity: 1; } }
</style>

<script>
(function () {
  var root = document.querySelector("[data-w1lyr]");
  if (!root) return;
  var off = []; // cleanup list, used by the React version
  var SPEED = 100; // demo scroll in px per second until someone touches the box; 0 turns it off
  var MID = "-48% 0px -48% 0px"; // a step becomes active when it crosses the middle of the box
  var reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
  var steps = root.querySelectorAll("[data-i]"), lastStep = steps[steps.length - 1].getAttribute("data-i");
  function on(el, n, f) { el.addEventListener(n, f, { passive: true }); off.push(function () { el.removeEventListener(n, f); }); }
  function set(i) {
    if (root.getAttribute("data-step") === i) return;
    root.setAttribute("data-step", i);
  }
  if (reduce) set(lastStep);
  else {
    // Which step is active: one observer on the nearest scroller. For a section on a normal page use root: null.
    var io = new IntersectionObserver(function (es) {
      es.forEach(function (e) { if (e.isIntersecting) set(e.target.getAttribute("data-i")); });
    }, { root: root, rootMargin: MID });
    steps.forEach(function (s) { io.observe(s); });
    off.push(function () { io.disconnect(); });
    // Slow demo scroll so the preview moves; any wheel, touch, click or key hands control back.
    var frame = 0, t0 = 0, pos = 0, seen = true, done = !SPEED;
    var tick = function (t) {
      pos += t0 ? SPEED * Math.min(t - t0, 50) / 1000 : 0;
      t0 = t;
      if (pos >= root.scrollHeight - root.clientHeight) pos = 0;
      root.scrollTop = pos;
      frame = requestAnimationFrame(tick);
    };
    var play = function () { if (!done && seen && !frame) { t0 = 0; frame = requestAnimationFrame(tick); } };
    var stop = function () { cancelAnimationFrame(frame); frame = 0; };
    off.push(stop);
    var vis = new IntersectionObserver(function (e) { seen = e[0].isIntersecting; if (seen) play(); else stop(); });
    vis.observe(root);
    off.push(function () { vis.disconnect(); });
    ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (n) {
      on(root, n, function () { done = true; stop(); root.setAttribute("data-touched", ""); });
    });
    play();
  }
})();
</script>

With reduced motion: The three layers stay pulled apart at full strength with their names showing, beside the steps as a plain list.

Running cost: Three flat plates move with translate and fade with opacity; the tilt is a fixed transform that never changes.

  • Spread the layers further or closer with the `24cqmin` translate values on `.w1lyr-p-face` and `.w1lyr-p-lin`.
  • Change the plate angle with `rotateX(58deg) rotateZ(-45deg)` on `.w1lyr-plate`.
  • Add a layer by adding a `.w1lyr-pl` block, giving it a translate and a matching step.

Photo Zooms To Each Detail

One overhead photo stays pinned while a pottery studio walks through its class kit. Each step pans and scales the photo to frame the tool being described, with a small caption naming it. Works for menus, workshops, interiors and product flat lays where one good photo holds every detail.

<section class="w1crp" data-w1crp data-step="1" data-side="left" tabindex="0" aria-label="What is on your board at a pottery class, scrollable">
  <div class="w1crp-hint" aria-hidden="true"><span>Scroll inside</span></div>
  <div class="w1crp-grid">
    <div class="w1crp-vis">
      <div class="w1crp-frame" role="img" aria-label="Overhead photo of a pottery board holding a lump of brown clay, a round yellow sponge, a blue sponge on a wooden stick, tubs of slip and a small metal turntable.">
        <img class="w1crp-img" src="https://images.pexels.com/photos/27837201/pexels-photo-27837201.jpeg?auto=compress&cs=tinysrgb&w=1600" alt="" width="1600" height="1067" decoding="async">
        <p class="w1crp-cap" aria-hidden="true"><span>The whole board</span><span>Stoneware clay</span><span>Natural sponge</span><span>Sponge stick</span><span>Banding wheel</span></p>
      </div>
    </div>
    <div class="w1crp-col">
      <header class="w1crp-head" data-i="1"><p class="w1crp-eyebrow">Ashgrove Clay Studio</p><h2 class="w1crp-h">What is on your board on a Tuesday night</h2><p class="w1crp-lede">Our beginners' wheel course starts with the same small kit for everyone. Scroll and the photo closes in on each piece.</p></header>
      <ol class="w1crp-steps">
      <li class="w1crp-step" data-i="1"><div class="w1crp-card"><p class="w1crp-when">Your board</p><h3>Everything arrives on one board</h3><p>Each place at the wheel gets the same kit, laid out before you sit down, so the first minutes go on clay rather than hunting for tools.</p></div></li>
      <li class="w1crp-step" data-i="2"><div class="w1crp-card"><p class="w1crp-when">Clay</p><h3>A kilo of buff stoneware</h3><p>Wedged and wrapped that morning. It is soft enough to centre on a first try and fires to a warm oatmeal colour.</p></div></li>
      <li class="w1crp-step" data-i="3"><div class="w1crp-card"><p class="w1crp-when">Sponge</p><h3>A natural sponge for water</h3><p>Squeezed over the clay as it spins, it keeps the surface slick without flooding the wheel head.</p></div></li>
      <li class="w1crp-step" data-i="4"><div class="w1crp-card"><p class="w1crp-when">Sponge stick</p><h3>A sponge on a dowel</h3><p>For the inside of tall pots, where a hand will not reach. It lifts out the water that pools at the bottom.</p></div></li>
      <li class="w1crp-step" data-i="5"><div class="w1crp-card"><p class="w1crp-when">Week four</p><h3>A small banding wheel</h3><p>Not for throwing. Once your pieces are dry you set them on it and turn them slowly while you paint bands of slip.</p></div></li>
      </ol>
    </div>
  </div>
  <div class="w1crp-end"><p>Six Tuesday evenings, clay and firing included.</p><a href="#" class="w1crp-btn">See course dates</a></div>
</section>

<style>
  /* Change these: the colours below, --w1crp-box (box height), and the translate() and scale() on .w1crp-img for each data-step. */
  .w1crp { --w1crp-bg: #f5ede6; --w1crp-ink: #2a1c15; --w1crp-soft: #5b4537; --w1crp-accent: #9a3d20; --w1crp-btnink: #fff; --w1crp-card: #fffaf6;
    --w1crp-line: #e6d6c8; --w1crp-panel: #d9cfc4; --w1crp-chip: rgba(42,28,21,.86); --w1crp-chipink: #f8efe8;
    --w1crp-display: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --w1crp-dw: 700; --w1crp-r: 6px; }
  .w1crp { --w1crp-box: 640px; height: var(--w1crp-box); overflow-y: auto; overflow-x: hidden; position: relative;
    background: var(--w1crp-bg); color: var(--w1crp-ink); font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; scrollbar-width: thin; }
  /* On a normal page: delete height and overflow above, set --w1crp-box: 100vh, and in the script use root: null. */
  .w1crp:focus-visible { outline: 3px solid var(--w1crp-accent); outline-offset: -3px; }
  .w1crp-hint { position: sticky; top: 0; height: 0; z-index: 5; display: flex; align-items: flex-start; justify-content: flex-end; pointer-events: none; }
  .w1crp-hint span { margin: 12px 12px 0 0; padding: 5px 12px; border-radius: 999px; background: var(--w1crp-chip); color: var(--w1crp-chipink);
    font-size: 12px; letter-spacing: .04em; transition: opacity .5s ease; }
  .w1crp[data-touched] .w1crp-hint span { opacity: 0; }
  .w1crp-grid { max-width: 72rem; margin: 0 auto; padding: 0 32px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 0 56px; }
  .w1crp[data-side="left"] .w1crp-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  .w1crp-vis { grid-column: 2; grid-row: 1; align-self: start; position: sticky; top: 0; z-index: 1; height: var(--w1crp-box);
    box-sizing: border-box; padding: 28px 0; display: flex; align-items: center; justify-content: center; }
  .w1crp[data-side="left"] .w1crp-vis { grid-column: 1; }
  .w1crp[data-side="left"] .w1crp-col { grid-column: 2; }
  .w1crp-frame { position: relative; width: min(100%, calc((var(--w1crp-box) - 56px) * 1.5)); aspect-ratio: 1.5; overflow: hidden;
    border-radius: var(--w1crp-r, 18px); background: var(--w1crp-panel);
    box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 28px 56px -28px rgba(0,0,0,.35); }
  .w1crp-col { grid-column: 1; grid-row: 1; position: relative; z-index: 2; min-width: 0; }
  .w1crp-head { padding: 56px 0 8px; }
  .w1crp-eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--w1crp-accent); }
  .w1crp-h { margin: 12px 0 0; font-family: var(--w1crp-display); font-weight: var(--w1crp-dw, 600); font-size: clamp(1.75rem, 3.6vw, 2.6rem); line-height: 1.1; letter-spacing: -.02em; }
  .w1crp-lede { margin: 14px 0 0; max-width: 30rem; font-size: 1.0625rem; line-height: 1.6; color: var(--w1crp-soft); }
  .w1crp-steps { list-style: none; margin: 0; padding: 0 0 calc(var(--w1crp-box) * .42); }
  .w1crp-step { min-height: calc(var(--w1crp-box) * .62); display: flex; align-items: center; }
  .w1crp-card { box-sizing: border-box; width: 100%; padding: 22px 24px; border-radius: 14px; background: var(--w1crp-card); border: 1px solid var(--w1crp-line);
    opacity: .55; transition: opacity .45s ease; }
  .w1crp[data-step="1"] .w1crp-step[data-i="1"] .w1crp-card,
  .w1crp[data-step="2"] .w1crp-step[data-i="2"] .w1crp-card,
  .w1crp[data-step="3"] .w1crp-step[data-i="3"] .w1crp-card,
  .w1crp[data-step="4"] .w1crp-step[data-i="4"] .w1crp-card,
  .w1crp[data-step="5"] .w1crp-step[data-i="5"] .w1crp-card { opacity: 1; }
  .w1crp-when { margin: 0; font-size: .8125rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--w1crp-accent); }
  .w1crp-card h3 { margin: 6px 0 0; font-size: 1.375rem; line-height: 1.25; font-weight: 650; }
  .w1crp-card h3 + p { margin: 8px 0 0; font-size: 1rem; line-height: 1.6; color: var(--w1crp-soft); }
  .w1crp-end { max-width: 72rem; margin: 0 auto; padding: 48px 32px 64px; display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; justify-content: space-between; border-top: 1px solid var(--w1crp-line); }
  .w1crp-end p { margin: 0; font-size: 1.0625rem; }
  .w1crp-btn { display: inline-flex; min-height: 46px; align-items: center; padding: 0 22px; border-radius: 999px; background: var(--w1crp-accent);
    color: var(--w1crp-btnink); font-weight: 600; font-size: .9375rem; text-decoration: none; transition: transform .2s ease; }
  .w1crp-btn:hover { transform: translateY(-1px); }
  .w1crp-btn:focus-visible { outline: 3px solid var(--w1crp-ink); outline-offset: 3px; }
  /* Phones: the visual pins at the top and the steps scroll up over it on solid cards. */
  @media (max-width: 760px) {
    .w1crp-grid, .w1crp[data-side="left"] .w1crp-grid { grid-template-columns: minmax(0, 1fr); padding: 0 16px; }
    .w1crp-vis, .w1crp[data-side="left"] .w1crp-vis { grid-column: 1; grid-row: 2; height: 280px; padding: 12px 0; background: var(--w1crp-bg); }
    .w1crp-frame { width: min(100%, calc(252px * 1.5)); }
    .w1crp-col, .w1crp[data-side="left"] .w1crp-col { display: contents; }
    .w1crp-head { grid-row: 1; padding: 36px 0 4px; }
    .w1crp-steps { grid-row: 3; position: relative; z-index: 2; }
    .w1crp-step { min-height: calc(var(--w1crp-box) * .5); align-items: flex-end; }
    .w1crp-card { opacity: 1; box-shadow: 0 14px 34px -16px rgba(0,0,0,.4); }
    .w1crp-end { padding: 40px 16px 56px; }
  }
  /* Reduced motion: nothing pins, the steps read as a plain list and the visual shows its final state. */
  @media (prefers-reduced-motion: reduce) {
    .w1crp-vis, .w1crp[data-side="left"] .w1crp-vis { position: relative; height: auto; }
    .w1crp-step { min-height: 0; padding: 8px 0; }
    .w1crp-steps { padding-bottom: 32px; }
    .w1crp .w1crp-card { opacity: 1; }
    .w1crp *, .w1crp *::before { transition: none !important; }
  }
  .w1crp-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform-origin: 50% 50%;
    transition: transform 1.1s cubic-bezier(.65,0,.25,1); will-change: transform; }
  .w1crp[data-step="2"] .w1crp-img { transform: translate(13.2%, -44%) scale(2.2); }
  .w1crp[data-step="3"] .w1crp-img { transform: translate(5.2%, 7.8%) scale(2.6); }
  .w1crp[data-step="4"] .w1crp-img { transform: translate(-25.5%, 6%) scale(3); }
  .w1crp[data-step="5"] .w1crp-img { transform: translate(0, 64.4%) scale(2.3); }
  .w1crp-cap { position: absolute; left: 0; bottom: 0; margin: 0; display: grid; padding: 14px; }
  .w1crp-cap span { grid-area: 1 / 1; justify-self: start; padding: 7px 12px; border-radius: 4px; background: var(--w1crp-chip); color: var(--w1crp-chipink);
    font-size: 13px; font-weight: 600; letter-spacing: .02em; opacity: 0; transform: translateY(8px); transition: opacity .35s ease .3s, transform .5s ease .3s; }
  .w1crp[data-step="1"] .w1crp-cap span:nth-child(1), .w1crp[data-step="2"] .w1crp-cap span:nth-child(2), .w1crp[data-step="3"] .w1crp-cap span:nth-child(3),
  .w1crp[data-step="4"] .w1crp-cap span:nth-child(4), .w1crp[data-step="5"] .w1crp-cap span:nth-child(5) { opacity: 1; transform: none; }
  @media (prefers-reduced-motion: reduce) { .w1crp .w1crp-img { transform: none; } .w1crp-cap { display: none; } }
</style>

<script>
(function () {
  var root = document.querySelector("[data-w1crp]");
  if (!root) return;
  var off = []; // cleanup list, used by the React version
  var SPEED = 100; // demo scroll in px per second until someone touches the box; 0 turns it off
  var MID = "-48% 0px -48% 0px"; // a step becomes active when it crosses the middle of the box
  var reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
  var steps = root.querySelectorAll("[data-i]"), lastStep = steps[steps.length - 1].getAttribute("data-i");
  function on(el, n, f) { el.addEventListener(n, f, { passive: true }); off.push(function () { el.removeEventListener(n, f); }); }
  function set(i) {
    if (root.getAttribute("data-step") === i) return;
    root.setAttribute("data-step", i);
  }
  if (reduce) set(lastStep);
  else {
    // Which step is active: one observer on the nearest scroller. For a section on a normal page use root: null.
    var io = new IntersectionObserver(function (es) {
      es.forEach(function (e) { if (e.isIntersecting) set(e.target.getAttribute("data-i")); });
    }, { root: root, rootMargin: MID });
    steps.forEach(function (s) { io.observe(s); });
    off.push(function () { io.disconnect(); });
    // Slow demo scroll so the preview moves; any wheel, touch, click or key hands control back.
    var frame = 0, t0 = 0, pos = 0, seen = true, done = !SPEED;
    var tick = function (t) {
      pos += t0 ? SPEED * Math.min(t - t0, 50) / 1000 : 0;
      t0 = t;
      if (pos >= root.scrollHeight - root.clientHeight) pos = 0;
      root.scrollTop = pos;
      frame = requestAnimationFrame(tick);
    };
    var play = function () { if (!done && seen && !frame) { t0 = 0; frame = requestAnimationFrame(tick); } };
    var stop = function () { cancelAnimationFrame(frame); frame = 0; };
    off.push(stop);
    var vis = new IntersectionObserver(function (e) { seen = e[0].isIntersecting; if (seen) play(); else stop(); });
    vis.observe(root);
    off.push(function () { vis.disconnect(); });
    ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (n) {
      on(root, n, function () { done = true; stop(); root.setAttribute("data-touched", ""); });
    });
    play();
  }
})();
</script>

With reduced motion: The full photo stays unzoomed above the five steps, which read as a plain list.

Running cost: Only a transform on one image changes, so each zoom runs on the compositor; the photo is loaded once at 1600px wide.

  • Aim a step at a new detail: for a point at x, y (0 to 1) and zoom s, use `translate(calc(-s * (x - .5) * 100%), ...)` on `.w1crp-img`.
  • Swap the photo `src`, keep `object-fit: cover`, and recheck each step's numbers against it.
  • Slow or speed the camera with the `1.1s` transition on `.w1crp-img`.

Sun Crosses The Sky Through A Day

A boat trip told through the hours of one day. A pinned seascape shifts sky colour with each step while the sun swings along its arc and the boat crosses the bay, with a clock in the corner naming the hour. Suits day tours, event schedules and any timeline where the time of day sets the mood.

<section class="w1sky" data-w1sky data-step="1" tabindex="0" aria-label="A day on the boat Kittiwake, scrollable">
  <div class="w1sky-hint" aria-hidden="true"><span>Scroll inside</span></div>
  <div class="w1sky-grid">
    <div class="w1sky-vis">
      <div class="w1sky-frame" role="img" aria-label="A painted seascape. The sun rises low on the left at 5:30, stands high at 9:00 and 13:00, and sets on the right at 17:30 while a small boat crosses the bay.">
        <div class="w1sky-sky w1sky-l1"></div><div class="w1sky-sky w1sky-l2"></div><div class="w1sky-sky w1sky-l3"></div><div class="w1sky-sky w1sky-l4"></div>
        <div class="w1sky-arm" aria-hidden="true"><span class="w1sky-sun"></span></div>
        <div class="w1sky-sea" aria-hidden="true"><span class="w1sky-dusk"></span>
          <svg class="w1sky-boat" viewBox="0 0 60 40"><path d="M6 28 H54 L47 36 H12Z" fill="#1d2830"></path><path d="M29 4 V27 M29 6 L44 25 H29Z" fill="#f3efe7" stroke="#1d2830" stroke-width="1.5"></path></svg>
        </div>
        <p class="w1sky-time" aria-hidden="true"><span>05:30</span><span>09:00</span><span>13:00</span><span>17:30</span></p>
      </div>
    </div>
    <div class="w1sky-col">
      <header class="w1sky-head" data-i="1"><p class="w1sky-eyebrow">Hartness Bay Sea Trips</p><h2 class="w1sky-h">A day aboard the Kittiwake</h2><p class="w1sky-lede">Our full-day trip leaves before sunrise and comes home with the light going. Scroll through the hours.</p></header>
      <ol class="w1sky-steps">
      <li class="w1sky-step" data-i="1"><div class="w1sky-card"><p class="w1sky-when">05:30</p><h3>Cast off in the half light</h3><p>Coffee in the wheelhouse as we clear the harbour wall. Gulls follow the boat out and the town is still asleep behind us.</p></div></li>
      <li class="w1sky-step" data-i="2"><div class="w1sky-card"><p class="w1sky-when">09:00</p><h3>Lines down over the mackerel ground</h3><p>Two miles out, where the sea floor drops away. Rods are on board for everyone, and the crew shows first-timers how to feel a bite.</p></div></li>
      <li class="w1sky-step" data-i="3"><div class="w1sky-card"><p class="w1sky-when">13:00</p><h3>Lunch at anchor in Ketch Cove</h3><p>A sheltered bay with seals on the rocks. Whatever was caught that morning goes on the grill, with bread and salad from the galley.</p></div></li>
      <li class="w1sky-step" data-i="4"><div class="w1sky-card"><p class="w1sky-when">17:30</p><h3>Home on the evening tide</h3><p>The run back faces the setting sun. We tie up at the quay as the lights come on along the front.</p></div></li>
      </ol>
    </div>
  </div>
  <div class="w1sky-end"><p>Twelve guests at most, life jackets and rods provided.</p><a href="#" class="w1sky-btn">Book the day trip</a></div>
</section>

<style>
  /* Change these: the colours below, --w1sky-box (box height), and the rotate() angle of .w1sky-arm and the boat translateX() for each data-step. */
  .w1sky { --w1sky-bg: #f3efe7; --w1sky-ink: #1d2830; --w1sky-soft: #4b5862; --w1sky-accent: #1b5a75; --w1sky-btnink: #fff; --w1sky-card: #fffdf9;
    --w1sky-line: #e2dbcd; --w1sky-panel: #8fa7c0; --w1sky-chip: rgba(29,40,48,.86); --w1sky-chipink: #fff;
    --w1sky-display: Georgia, "Iowan Old Style", serif; --w1sky-dw: 400; --w1sky-r: 22px; }
  .w1sky { --w1sky-box: 640px; height: var(--w1sky-box); overflow-y: auto; overflow-x: hidden; position: relative;
    background: var(--w1sky-bg); color: var(--w1sky-ink); font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; scrollbar-width: thin; }
  /* On a normal page: delete height and overflow above, set --w1sky-box: 100vh, and in the script use root: null. */
  .w1sky:focus-visible { outline: 3px solid var(--w1sky-accent); outline-offset: -3px; }
  .w1sky-hint { position: sticky; top: 0; height: 0; z-index: 5; display: flex; align-items: flex-start; justify-content: flex-end; pointer-events: none; }
  .w1sky-hint span { margin: 12px 12px 0 0; padding: 5px 12px; border-radius: 999px; background: var(--w1sky-chip); color: var(--w1sky-chipink);
    font-size: 12px; letter-spacing: .04em; transition: opacity .5s ease; }
  .w1sky[data-touched] .w1sky-hint span { opacity: 0; }
  .w1sky-grid { max-width: 72rem; margin: 0 auto; padding: 0 32px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 0 56px; }
  .w1sky[data-side="left"] .w1sky-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  .w1sky-vis { grid-column: 2; grid-row: 1; align-self: start; position: sticky; top: 0; z-index: 1; height: var(--w1sky-box);
    box-sizing: border-box; padding: 28px 0; display: flex; align-items: center; justify-content: center; }
  .w1sky[data-side="left"] .w1sky-vis { grid-column: 1; }
  .w1sky[data-side="left"] .w1sky-col { grid-column: 2; }
  .w1sky-frame { position: relative; width: min(100%, calc((var(--w1sky-box) - 56px) * 1.25)); aspect-ratio: 1.25; overflow: hidden;
    border-radius: var(--w1sky-r, 18px); background: var(--w1sky-panel);
    box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 28px 56px -28px rgba(0,0,0,.35); }
  .w1sky-col { grid-column: 1; grid-row: 1; position: relative; z-index: 2; min-width: 0; }
  .w1sky-head { padding: 56px 0 8px; }
  .w1sky-eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--w1sky-accent); }
  .w1sky-h { margin: 12px 0 0; font-family: var(--w1sky-display); font-weight: var(--w1sky-dw, 600); font-size: clamp(1.75rem, 3.6vw, 2.6rem); line-height: 1.1; letter-spacing: -.02em; }
  .w1sky-lede { margin: 14px 0 0; max-width: 30rem; font-size: 1.0625rem; line-height: 1.6; color: var(--w1sky-soft); }
  .w1sky-steps { list-style: none; margin: 0; padding: 0 0 calc(var(--w1sky-box) * .42); }
  .w1sky-step { min-height: calc(var(--w1sky-box) * .62); display: flex; align-items: center; }
  .w1sky-card { box-sizing: border-box; width: 100%; padding: 22px 24px; border-radius: 14px; background: var(--w1sky-card); border: 1px solid var(--w1sky-line);
    opacity: .55; transition: opacity .45s ease; }
  .w1sky[data-step="1"] .w1sky-step[data-i="1"] .w1sky-card,
  .w1sky[data-step="2"] .w1sky-step[data-i="2"] .w1sky-card,
  .w1sky[data-step="3"] .w1sky-step[data-i="3"] .w1sky-card,
  .w1sky[data-step="4"] .w1sky-step[data-i="4"] .w1sky-card { opacity: 1; }
  .w1sky-when { margin: 0; font-size: .8125rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--w1sky-accent); }
  .w1sky-card h3 { margin: 6px 0 0; font-size: 1.375rem; line-height: 1.25; font-weight: 650; }
  .w1sky-card h3 + p { margin: 8px 0 0; font-size: 1rem; line-height: 1.6; color: var(--w1sky-soft); }
  .w1sky-end { max-width: 72rem; margin: 0 auto; padding: 48px 32px 64px; display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; justify-content: space-between; border-top: 1px solid var(--w1sky-line); }
  .w1sky-end p { margin: 0; font-size: 1.0625rem; }
  .w1sky-btn { display: inline-flex; min-height: 46px; align-items: center; padding: 0 22px; border-radius: 999px; background: var(--w1sky-accent);
    color: var(--w1sky-btnink); font-weight: 600; font-size: .9375rem; text-decoration: none; transition: transform .2s ease; }
  .w1sky-btn:hover { transform: translateY(-1px); }
  .w1sky-btn:focus-visible { outline: 3px solid var(--w1sky-ink); outline-offset: 3px; }
  /* Phones: the visual pins at the top and the steps scroll up over it on solid cards. */
  @media (max-width: 760px) {
    .w1sky-grid, .w1sky[data-side="left"] .w1sky-grid { grid-template-columns: minmax(0, 1fr); padding: 0 16px; }
    .w1sky-vis, .w1sky[data-side="left"] .w1sky-vis { grid-column: 1; grid-row: 2; height: 290px; padding: 12px 0; background: var(--w1sky-bg); }
    .w1sky-frame { width: min(100%, calc(262px * 1.25)); }
    .w1sky-col, .w1sky[data-side="left"] .w1sky-col { display: contents; }
    .w1sky-head { grid-row: 1; padding: 36px 0 4px; }
    .w1sky-steps { grid-row: 3; position: relative; z-index: 2; }
    .w1sky-step { min-height: calc(var(--w1sky-box) * .5); align-items: flex-end; }
    .w1sky-card { opacity: 1; box-shadow: 0 14px 34px -16px rgba(0,0,0,.4); }
    .w1sky-end { padding: 40px 16px 56px; }
  }
  /* Reduced motion: nothing pins, the steps read as a plain list and the visual shows its final state. */
  @media (prefers-reduced-motion: reduce) {
    .w1sky-vis, .w1sky[data-side="left"] .w1sky-vis { position: relative; height: auto; }
    .w1sky-step { min-height: 0; padding: 8px 0; }
    .w1sky-steps { padding-bottom: 32px; }
    .w1sky .w1sky-card { opacity: 1; }
    .w1sky *, .w1sky *::before { transition: none !important; }
  }
  .w1sky-sky { position: absolute; inset: 0; opacity: 0; transition: opacity 1s ease; }
  .w1sky-l1 { background: linear-gradient(#7f98b6, #e8bf9c 70%); opacity: 1; }
  .w1sky-l2 { background: linear-gradient(#a9cde4, #eef4f2 72%); }
  .w1sky-l3 { background: linear-gradient(#7fb4d8, #d6eaf3 72%); }
  .w1sky-l4 { background: linear-gradient(#3f4f7a, #e58a57 72%); }
  .w1sky[data-step="2"] .w1sky-l2, .w1sky[data-step="3"] .w1sky-l3, .w1sky[data-step="4"] .w1sky-l4 { opacity: 1; }
  .w1sky-arm { position: absolute; left: 50%; top: 72%; width: 0; height: 0; transform: rotate(-74deg); transition: transform 1.3s cubic-bezier(.5,0,.25,1); }
  .w1sky-sun { position: absolute; left: -26px; top: -26px; width: 52px; height: 52px; border-radius: 50%; background: radial-gradient(circle, #fff6dc 30%, #ffd98c 60%, rgba(255,210,130,0) 72%); }
  .w1sky-frame { container-type: inline-size; }
  .w1sky-sun { transform: translateY(-46cqi); }
  .w1sky[data-step="2"] .w1sky-arm { transform: rotate(-30deg); }
  .w1sky[data-step="3"] .w1sky-arm { transform: rotate(14deg); }
  .w1sky[data-step="4"] .w1sky-arm { transform: rotate(64deg); }
  .w1sky-sea { position: absolute; left: 0; right: 0; top: 72%; bottom: 0; background: linear-gradient(#2c6a86, #1d4c63); }
  .w1sky-sea::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: rgba(255,255,255,.35); }
  .w1sky-dusk { position: absolute; inset: 0; background: linear-gradient(#5a3f52, #1a2a3c); opacity: 0; transition: opacity 1s ease; }
  .w1sky[data-step="4"] .w1sky-dusk { opacity: .7; }
  .w1sky-boat { position: absolute; left: 8%; top: -22px; width: 54px; transform: translateX(0); transition: transform 1.3s cubic-bezier(.5,0,.25,1); }
  .w1sky[data-step="2"] .w1sky-boat { transform: translateX(16cqi); }
  .w1sky[data-step="3"] .w1sky-boat { transform: translateX(52cqi); }
  .w1sky[data-step="4"] .w1sky-boat { transform: translateX(22cqi); }
  .w1sky-time { position: absolute; left: 18px; top: 14px; margin: 0; display: grid; }
  .w1sky-time span { grid-area: 1 / 1; padding: 6px 12px; border-radius: 999px; background: var(--w1sky-chip); color: var(--w1sky-chipink);
    font: 600 15px/1.2 ui-monospace, "SF Mono", Menlo, monospace; opacity: 0; transition: opacity .4s ease; }
  .w1sky[data-step="1"] .w1sky-time span:nth-child(1), .w1sky[data-step="2"] .w1sky-time span:nth-child(2),
  .w1sky[data-step="3"] .w1sky-time span:nth-child(3), .w1sky[data-step="4"] .w1sky-time span:nth-child(4) { opacity: 1; }
</style>

<script>
(function () {
  var root = document.querySelector("[data-w1sky]");
  if (!root) return;
  var off = []; // cleanup list, used by the React version
  var SPEED = 100; // demo scroll in px per second until someone touches the box; 0 turns it off
  var MID = "-48% 0px -48% 0px"; // a step becomes active when it crosses the middle of the box
  var reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
  var steps = root.querySelectorAll("[data-i]"), lastStep = steps[steps.length - 1].getAttribute("data-i");
  function on(el, n, f) { el.addEventListener(n, f, { passive: true }); off.push(function () { el.removeEventListener(n, f); }); }
  function set(i) {
    if (root.getAttribute("data-step") === i) return;
    root.setAttribute("data-step", i);
  }
  if (reduce) set(lastStep);
  else {
    // Which step is active: one observer on the nearest scroller. For a section on a normal page use root: null.
    var io = new IntersectionObserver(function (es) {
      es.forEach(function (e) { if (e.isIntersecting) set(e.target.getAttribute("data-i")); });
    }, { root: root, rootMargin: MID });
    steps.forEach(function (s) { io.observe(s); });
    off.push(function () { io.disconnect(); });
    // Slow demo scroll so the preview moves; any wheel, touch, click or key hands control back.
    var frame = 0, t0 = 0, pos = 0, seen = true, done = !SPEED;
    var tick = function (t) {
      pos += t0 ? SPEED * Math.min(t - t0, 50) / 1000 : 0;
      t0 = t;
      if (pos >= root.scrollHeight - root.clientHeight) pos = 0;
      root.scrollTop = pos;
      frame = requestAnimationFrame(tick);
    };
    var play = function () { if (!done && seen && !frame) { t0 = 0; frame = requestAnimationFrame(tick); } };
    var stop = function () { cancelAnimationFrame(frame); frame = 0; };
    off.push(stop);
    var vis = new IntersectionObserver(function (e) { seen = e[0].isIntersecting; if (seen) play(); else stop(); });
    vis.observe(root);
    off.push(function () { vis.disconnect(); });
    ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (n) {
      on(root, n, function () { done = true; stop(); root.setAttribute("data-touched", ""); });
    });
    play();
  }
})();
</script>

With reduced motion: The scene holds still at evening, with the sun low and the boat in the bay, above all four hours as a list.

Running cost: Four stacked gradient layers fade with opacity and two elements move with transform; the scene uses no images.

  • Move the sun for a step with its `rotate()` angle on `.w1sky-arm`; minus 90 is the left horizon, 90 the right.
  • Repaint each hour by editing the gradients on `.w1sky-l1` to `.w1sky-l4`.
  • Change where the boat sits with the `translateX()` value in `cqi` for each step on `.w1sky-boat`.

Walking Route Grows Across Pinned Map

A guided fell walk told as a route on a pinned map. Each step of text moves a pin to the next stop, draws in the leg just walked and pans the map to frame it, with a small readout of the distance so far. Suits tours, races, delivery rounds and any story that is really a journey.

<section class="w1map" data-w1map data-step="1" tabindex="0" aria-label="The Hollins Round walking route, scrollable">
  <div class="w1map-hint" aria-hidden="true"><span>Scroll inside</span></div>
  <div class="w1map-grid">
    <div class="w1map-vis">
      <div class="w1map-frame" role="img" aria-label="Map of the Hollins Round: from Alder Gate car park north-east to Fernwater tarn, up to Hollins Top, then south down to the Mill Inn.">
        <svg class="w1map-svg" viewBox="0 0 400 300" aria-hidden="true">
          <g class="w1map-pan">
            <rect width="400" height="300" fill="#e7e2cf"></rect>
            <path d="M0 40 C60 20 110 60 150 30 C170 15 190 0 200 0 L0 0Z M300 300 C320 260 370 270 400 250 L400 300Z M0 180 C30 170 40 210 20 230 C10 240 0 236 0 236Z" fill="#cfd6ba"></path>
            <g fill="none" stroke="#d2c7a8" stroke-width="1.2">
              <ellipse cx="300" cy="84" rx="34" ry="22"></ellipse>
              <ellipse cx="300" cy="88" rx="62" ry="42"></ellipse>
              <ellipse cx="296" cy="94" rx="94" ry="64"></ellipse>
              <ellipse cx="290" cy="100" rx="128" ry="90"></ellipse>
            </g>
            <path d="M232 112 C244 150 250 190 238 230 C228 262 236 286 244 300" fill="none" stroke="#9fb6b8" stroke-width="2.4"></path>
            <ellipse cx="214" cy="98" rx="36" ry="18" fill="#adc2c2"></ellipse>
            <path d="M60 252 C90 220 120 200 185 150 C220 130 250 120 300 80 C330 120 360 170 345 240" fill="none" stroke="#a89c80" stroke-width="2" stroke-dasharray="2 6" stroke-linecap="round"></path>
            <path class="w1map-seg w1map-s1" d="M60 252 C90 220 120 200 185 150" fill="none" stroke="#a3441f" stroke-width="4" stroke-linecap="round"></path>
            <path class="w1map-seg w1map-s2" d="M185 150 C220 130 250 120 300 80" fill="none" stroke="#a3441f" stroke-width="4" stroke-linecap="round"></path>
            <path class="w1map-seg w1map-s3" d="M300 80 C330 120 360 170 345 240" fill="none" stroke="#a3441f" stroke-width="4" stroke-linecap="round"></path>
            <g fill="#fbfcf7" stroke="#20271f" stroke-width="2">
              <circle cx="60" cy="252" r="5"></circle><circle cx="185" cy="150" r="5"></circle><circle cx="300" cy="80" r="5"></circle><circle cx="345" cy="240" r="5"></circle>
            </g>
            <g font-size="10" font-family="ui-sans-serif, system-ui, sans-serif" font-weight="600" fill="#20271f">
              <text x="72" y="268">Alder Gate</text><text x="120" y="172">Fernwater</text><text x="312" y="70">Hollins Top</text><text x="290" y="262">Mill Inn</text>
            </g>
            <g class="w1map-pin"><path d="M0 0 C-3 -8 -10 -12 -10 -20 A10 10 0 0 1 10 -20 C10 -12 3 -8 0 0Z" fill="#20271f"></path><circle cy="-20" r="3.6" fill="#f2f3ec"></circle></g>
          </g>
          <g transform="translate(332 22)" fill="none" stroke="#20271f" stroke-width="1.4"><circle r="13" fill="#fbfcf7" fill-opacity=".8"></circle><path d="M0 -9 L4 3 L0 1 L-4 3Z" fill="#20271f"></path></g>
        </svg>
        <p class="w1map-read" aria-hidden="true"><span>Alder Gate, 0 km</span><span>Fernwater, 4.2 km</span><span>Hollins Top, 8.9 km</span><span>Mill Inn, 14.1 km</span></p>
      </div>
    </div>
    <div class="w1map-col">
      <header class="w1map-head" data-i="1"><p class="w1map-eyebrow">Fellside Guiding</p><h2 class="w1map-h">The Hollins Round, one stop at a time</h2><p class="w1map-lede">A full-day guided walk over the fells. Scroll and the map follows the group from the car park to the inn.</p></header>
      <ol class="w1map-steps">
      <li class="w1map-step" data-i="1"><div class="w1map-card"><p class="w1map-when">Start, 9:00</p><h3>Alder Gate car park</h3><p>Boots on and maps out by the gate. The first hour follows an old drovers' track through birch and bracken, climbing gently.</p></div></li>
      <li class="w1map-step" data-i="2"><div class="w1map-card"><p class="w1map-when">4.2 km</p><h3>Lunch at Fernwater</h3><p>The track levels out beside a small tarn. We stop on the flat rocks at its southern end, out of the westerly wind.</p></div></li>
      <li class="w1map-step" data-i="3"><div class="w1map-card"><p class="w1map-when">8.9 km</p><h3>Hollins Top</h3><p>The steepest pull of the day, a stepped path up to the cairn. On a clear afternoon the coast shows as a pale line to the west.</p></div></li>
      <li class="w1map-step" data-i="4"><div class="w1map-card"><p class="w1map-when">14.1 km, about 16:30</p><h3>Down to the Mill Inn</h3><p>A long, easy descent on the east shoulder ends at the inn by the river, where the minibus waits to take everyone back.</p></div></li>
      </ol>
    </div>
  </div>
  <div class="w1map-end"><p>Groups of eight, Saturdays from May to September.</p><a href="#" class="w1map-btn">Book a place</a></div>
</section>

<style>
  /* Change these: the colours below, --w1map-box (box height), and the pan and pin transforms for each data-step near the end. */
  .w1map { --w1map-bg: #eef0e7; --w1map-ink: #20271f; --w1map-soft: #4a5446; --w1map-accent: #a3441f; --w1map-btnink: #fff; --w1map-card: #fbfcf7;
    --w1map-line: #d9dccd; --w1map-panel: #e7e2cf; --w1map-chip: rgba(32,39,31,.86); --w1map-chipink: #f2f3ec;
    --w1map-display: Georgia, "Iowan Old Style", serif; --w1map-dw: 400; }
  .w1map { --w1map-box: 640px; height: var(--w1map-box); overflow-y: auto; overflow-x: hidden; position: relative;
    background: var(--w1map-bg); color: var(--w1map-ink); font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; scrollbar-width: thin; }
  /* On a normal page: delete height and overflow above, set --w1map-box: 100vh, and in the script use root: null. */
  .w1map:focus-visible { outline: 3px solid var(--w1map-accent); outline-offset: -3px; }
  .w1map-hint { position: sticky; top: 0; height: 0; z-index: 5; display: flex; align-items: flex-start; justify-content: flex-end; pointer-events: none; }
  .w1map-hint span { margin: 12px 12px 0 0; padding: 5px 12px; border-radius: 999px; background: var(--w1map-chip); color: var(--w1map-chipink);
    font-size: 12px; letter-spacing: .04em; transition: opacity .5s ease; }
  .w1map[data-touched] .w1map-hint span { opacity: 0; }
  .w1map-grid { max-width: 72rem; margin: 0 auto; padding: 0 32px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 0 56px; }
  .w1map[data-side="left"] .w1map-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  .w1map-vis { grid-column: 2; grid-row: 1; align-self: start; position: sticky; top: 0; z-index: 1; height: var(--w1map-box);
    box-sizing: border-box; padding: 28px 0; display: flex; align-items: center; justify-content: center; }
  .w1map[data-side="left"] .w1map-vis { grid-column: 1; }
  .w1map[data-side="left"] .w1map-col { grid-column: 2; }
  .w1map-frame { position: relative; width: min(100%, calc((var(--w1map-box) - 56px) * 1.3333)); aspect-ratio: 1.3333; overflow: hidden;
    border-radius: var(--w1map-r, 18px); background: var(--w1map-panel);
    box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 28px 56px -28px rgba(0,0,0,.35); }
  .w1map-col { grid-column: 1; grid-row: 1; position: relative; z-index: 2; min-width: 0; }
  .w1map-head { padding: 56px 0 8px; }
  .w1map-eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--w1map-accent); }
  .w1map-h { margin: 12px 0 0; font-family: var(--w1map-display); font-weight: var(--w1map-dw, 600); font-size: clamp(1.75rem, 3.6vw, 2.6rem); line-height: 1.1; letter-spacing: -.02em; }
  .w1map-lede { margin: 14px 0 0; max-width: 30rem; font-size: 1.0625rem; line-height: 1.6; color: var(--w1map-soft); }
  .w1map-steps { list-style: none; margin: 0; padding: 0 0 calc(var(--w1map-box) * .42); }
  .w1map-step { min-height: calc(var(--w1map-box) * .62); display: flex; align-items: center; }
  .w1map-card { box-sizing: border-box; width: 100%; padding: 22px 24px; border-radius: 14px; background: var(--w1map-card); border: 1px solid var(--w1map-line);
    opacity: .55; transition: opacity .45s ease; }
  .w1map[data-step="1"] .w1map-step[data-i="1"] .w1map-card,
  .w1map[data-step="2"] .w1map-step[data-i="2"] .w1map-card,
  .w1map[data-step="3"] .w1map-step[data-i="3"] .w1map-card,
  .w1map[data-step="4"] .w1map-step[data-i="4"] .w1map-card { opacity: 1; }
  .w1map-when { margin: 0; font-size: .8125rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--w1map-accent); }
  .w1map-card h3 { margin: 6px 0 0; font-size: 1.375rem; line-height: 1.25; font-weight: 650; }
  .w1map-card h3 + p { margin: 8px 0 0; font-size: 1rem; line-height: 1.6; color: var(--w1map-soft); }
  .w1map-end { max-width: 72rem; margin: 0 auto; padding: 48px 32px 64px; display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; justify-content: space-between; border-top: 1px solid var(--w1map-line); }
  .w1map-end p { margin: 0; font-size: 1.0625rem; }
  .w1map-btn { display: inline-flex; min-height: 46px; align-items: center; padding: 0 22px; border-radius: 999px; background: var(--w1map-accent);
    color: var(--w1map-btnink); font-weight: 600; font-size: .9375rem; text-decoration: none; transition: transform .2s ease; }
  .w1map-btn:hover { transform: translateY(-1px); }
  .w1map-btn:focus-visible { outline: 3px solid var(--w1map-ink); outline-offset: 3px; }
  /* Phones: the visual pins at the top and the steps scroll up over it on solid cards. */
  @media (max-width: 760px) {
    .w1map-grid, .w1map[data-side="left"] .w1map-grid { grid-template-columns: minmax(0, 1fr); padding: 0 16px; }
    .w1map-vis, .w1map[data-side="left"] .w1map-vis { grid-column: 1; grid-row: 2; height: 300px; padding: 12px 0; background: var(--w1map-bg); }
    .w1map-frame { width: min(100%, calc(272px * 1.3333)); }
    .w1map-col, .w1map[data-side="left"] .w1map-col { display: contents; }
    .w1map-head { grid-row: 1; padding: 36px 0 4px; }
    .w1map-steps { grid-row: 3; position: relative; z-index: 2; }
    .w1map-step { min-height: calc(var(--w1map-box) * .5); align-items: flex-end; }
    .w1map-card { opacity: 1; box-shadow: 0 14px 34px -16px rgba(0,0,0,.4); }
    .w1map-end { padding: 40px 16px 56px; }
  }
  /* Reduced motion: nothing pins, the steps read as a plain list and the visual shows its final state. */
  @media (prefers-reduced-motion: reduce) {
    .w1map-vis, .w1map[data-side="left"] .w1map-vis { position: relative; height: auto; }
    .w1map-step { min-height: 0; padding: 8px 0; }
    .w1map-steps { padding-bottom: 32px; }
    .w1map .w1map-card { opacity: 1; }
    .w1map *, .w1map *::before { transition: none !important; }
  }
  .w1map-svg { display: block; width: 100%; height: 100%; }
  .w1map-pan { transform-box: view-box; transform-origin: 0 0; transform: translate(0, -90px) scale(1.3); transition: transform 1.1s cubic-bezier(.6,0,.2,1); }
  .w1map-pin { transform: translate(60px, 252px); transition: transform 1s cubic-bezier(.5,0,.2,1); }
  .w1map-seg { opacity: 0; transition: opacity .7s ease .25s; }
  .w1map-read { position: absolute; left: 14px; bottom: 14px; margin: 0; display: grid; }
  .w1map-read span { grid-area: 1 / 1; padding: 7px 12px; border-radius: 8px; background: var(--w1map-chip); color: var(--w1map-chipink); font-size: 13px; font-weight: 600;
    opacity: 0; transform: translateY(6px); transition: opacity .4s ease, transform .4s ease; }
  .w1map[data-step="1"] .w1map-read span:nth-child(1), .w1map[data-step="2"] .w1map-read span:nth-child(2),
  .w1map[data-step="3"] .w1map-read span:nth-child(3), .w1map[data-step="4"] .w1map-read span:nth-child(4) { opacity: 1; transform: none; }
  .w1map[data-step="2"] .w1map-pan { transform: translate(-40px, -45px) scale(1.3); }
  .w1map[data-step="3"] .w1map-pan { transform: translate(-120px, 0) scale(1.3); }
  .w1map[data-step="4"] .w1map-pan { transform: none; }
  .w1map[data-step="2"] .w1map-pin { transform: translate(185px, 150px); }
  .w1map[data-step="3"] .w1map-pin { transform: translate(300px, 80px); }
  .w1map[data-step="4"] .w1map-pin { transform: translate(345px, 240px); }
  .w1map[data-step="2"] .w1map-s1, .w1map[data-step="3"] .w1map-s1, .w1map[data-step="3"] .w1map-s2, .w1map[data-step="4"] .w1map-seg { opacity: 1; }
</style>

<script>
(function () {
  var root = document.querySelector("[data-w1map]");
  if (!root) return;
  var off = []; // cleanup list, used by the React version
  var SPEED = 100; // demo scroll in px per second until someone touches the box; 0 turns it off
  var MID = "-48% 0px -48% 0px"; // a step becomes active when it crosses the middle of the box
  var reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
  var steps = root.querySelectorAll("[data-i]"), lastStep = steps[steps.length - 1].getAttribute("data-i");
  function on(el, n, f) { el.addEventListener(n, f, { passive: true }); off.push(function () { el.removeEventListener(n, f); }); }
  function set(i) {
    if (root.getAttribute("data-step") === i) return;
    root.setAttribute("data-step", i);
  }
  if (reduce) set(lastStep);
  else {
    // Which step is active: one observer on the nearest scroller. For a section on a normal page use root: null.
    var io = new IntersectionObserver(function (es) {
      es.forEach(function (e) { if (e.isIntersecting) set(e.target.getAttribute("data-i")); });
    }, { root: root, rootMargin: MID });
    steps.forEach(function (s) { io.observe(s); });
    off.push(function () { io.disconnect(); });
    // Slow demo scroll so the preview moves; any wheel, touch, click or key hands control back.
    var frame = 0, t0 = 0, pos = 0, seen = true, done = !SPEED;
    var tick = function (t) {
      pos += t0 ? SPEED * Math.min(t - t0, 50) / 1000 : 0;
      t0 = t;
      if (pos >= root.scrollHeight - root.clientHeight) pos = 0;
      root.scrollTop = pos;
      frame = requestAnimationFrame(tick);
    };
    var play = function () { if (!done && seen && !frame) { t0 = 0; frame = requestAnimationFrame(tick); } };
    var stop = function () { cancelAnimationFrame(frame); frame = 0; };
    off.push(stop);
    var vis = new IntersectionObserver(function (e) { seen = e[0].isIntersecting; if (seen) play(); else stop(); });
    vis.observe(root);
    off.push(function () { vis.disconnect(); });
    ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (n) {
      on(root, n, function () { done = true; stop(); root.setAttribute("data-touched", ""); });
    });
    play();
  }
})();
</script>

With reduced motion: The map shows the whole route with all three legs drawn and the pin at the inn, beside a plain list of stops.

Running cost: One IntersectionObserver swaps a data attribute; the pan and pin are transform transitions on one small SVG.

  • Move a stop by changing its circle, label and the matching `translate()` on `.w1map-pin` for that `data-step`.
  • Change how close the map zooms with the `scale(1.3)` values on `.w1map-pan`.
  • Recolour the walked route with the `stroke` on the `.w1map-seg` paths and `--w1map-accent`.

Year Of Weeks Fills By Season

A farm veg box shows its year as 52 small squares, one per weekly delivery. Each season's step fills its row with a quick stagger in that season's colour and names what is in the boxes. A unit chart like this suits subscriptions, school terms, training plans and anything counted in weeks.

<section class="w1wks" data-w1wks data-step="1" data-side="left" tabindex="0" aria-label="A year of Oak Row Farm veg boxes, scrollable">
  <div class="w1wks-hint" aria-hidden="true"><span>Scroll inside</span></div>
  <div class="w1wks-grid">
    <div class="w1wks-vis">
      <div class="w1wks-frame" role="img" aria-label="A calendar of 52 weekly boxes in four rows. Spring, March to May: asparagus, radish, wild garlic. Summer, June to August: beans, courgettes, tomatoes. Autumn, September to November: squash, apples, leeks. Winter, December to February: kale, parsnips, stored roots.">
        <div class="w1wks-cal" aria-hidden="true">
        <div class="w1wks-row w1wks-q1"><p class="w1wks-lab"><b>Spring</b><span>Mar to May</span></p><div class="w1wks-cells"><i style="--d: 0.000s"></i><i style="--d: 0.035s"></i><i style="--d: 0.070s"></i><i style="--d: 0.105s"></i><i style="--d: 0.140s"></i><i style="--d: 0.175s"></i><i style="--d: 0.210s"></i><i style="--d: 0.245s"></i><i style="--d: 0.280s"></i><i style="--d: 0.315s"></i><i style="--d: 0.350s"></i><i style="--d: 0.385s"></i><i style="--d: 0.420s"></i></div><p class="w1wks-crop">Asparagus, radish, wild garlic</p></div>
        <div class="w1wks-row w1wks-q2"><p class="w1wks-lab"><b>Summer</b><span>Jun to Aug</span></p><div class="w1wks-cells"><i style="--d: 0.000s"></i><i style="--d: 0.035s"></i><i style="--d: 0.070s"></i><i style="--d: 0.105s"></i><i style="--d: 0.140s"></i><i style="--d: 0.175s"></i><i style="--d: 0.210s"></i><i style="--d: 0.245s"></i><i style="--d: 0.280s"></i><i style="--d: 0.315s"></i><i style="--d: 0.350s"></i><i style="--d: 0.385s"></i><i style="--d: 0.420s"></i></div><p class="w1wks-crop">Beans, courgettes, tomatoes</p></div>
        <div class="w1wks-row w1wks-q3"><p class="w1wks-lab"><b>Autumn</b><span>Sep to Nov</span></p><div class="w1wks-cells"><i style="--d: 0.000s"></i><i style="--d: 0.035s"></i><i style="--d: 0.070s"></i><i style="--d: 0.105s"></i><i style="--d: 0.140s"></i><i style="--d: 0.175s"></i><i style="--d: 0.210s"></i><i style="--d: 0.245s"></i><i style="--d: 0.280s"></i><i style="--d: 0.315s"></i><i style="--d: 0.350s"></i><i style="--d: 0.385s"></i><i style="--d: 0.420s"></i></div><p class="w1wks-crop">Squash, apples, leeks</p></div>
        <div class="w1wks-row w1wks-q4"><p class="w1wks-lab"><b>Winter</b><span>Dec to Feb</span></p><div class="w1wks-cells"><i style="--d: 0.000s"></i><i style="--d: 0.035s"></i><i style="--d: 0.070s"></i><i style="--d: 0.105s"></i><i style="--d: 0.140s"></i><i style="--d: 0.175s"></i><i style="--d: 0.210s"></i><i style="--d: 0.245s"></i><i style="--d: 0.280s"></i><i style="--d: 0.315s"></i><i style="--d: 0.350s"></i><i style="--d: 0.385s"></i><i style="--d: 0.420s"></i></div><p class="w1wks-crop">Kale, parsnips, stored roots</p></div>
        </div>
      </div>
    </div>
    <div class="w1wks-col">
      <header class="w1wks-head" data-i="1"><p class="w1wks-eyebrow">Oak Row Farm</p><h2 class="w1wks-h">Fifty-two boxes, four seasons</h2><p class="w1wks-lede">A veg box subscription follows the field, not the supermarket. Scroll and the year fills in, one square per weekly box.</p></header>
      <ol class="w1wks-steps">
      <li class="w1wks-step" data-i="1"><div class="w1wks-card"><p class="w1wks-when">Spring</p><h3>The hungry gap ends</h3><p>Thirteen boxes from March. The first are lean, with stored potatoes and forced rhubarb, then asparagus and radishes arrive in a rush.</p></div></li>
      <li class="w1wks-step" data-i="2"><div class="w1wks-card"><p class="w1wks-when">Summer</p><h3>More than fits in the box</h3><p>Beans, courgettes and tomatoes by the crate. We add a recipe card most weeks, because nobody plans for that many courgettes.</p></div></li>
      <li class="w1wks-step" data-i="3"><div class="w1wks-card"><p class="w1wks-when">Autumn</p><h3>The heavy boxes</h3><p>Squash, apples from the old orchard and the first leeks. These are the weeks the box needs both hands.</p></div></li>
      <li class="w1wks-step" data-i="4"><div class="w1wks-card"><p class="w1wks-when">Winter</p><h3>Roots, greens and the store</h3><p>Kale and parsnips straight from frozen ground, plus onions and squash kept back from autumn. Every week of the year is covered.</p></div></li>
      </ol>
    </div>
  </div>
  <div class="w1wks-end"><p>Skip any week from your account, up to the Friday before.</p><a href="#" class="w1wks-btn">Start a box</a></div>
</section>

<style>
  /* Change these: the colours below, --w1wks-box (box height), and the four season colours in .w1wks-q1 to .w1wks-q4 and the 0.035s stagger per week. */
  .w1wks { --w1wks-bg: #f4f0e6; --w1wks-ink: #23281e; --w1wks-soft: #50574a; --w1wks-accent: #3d6833; --w1wks-btnink: #fff; --w1wks-card: #fffdf7;
    --w1wks-line: #e0dacb; --w1wks-panel: #fffdf7; --w1wks-chip: rgba(35,40,30,.86); --w1wks-chipink: #f4f0e6;
    --w1wks-display: Georgia, "Iowan Old Style", serif; --w1wks-dw: 400; --w1wks-r: 16px; }
  .w1wks { --w1wks-box: 640px; height: var(--w1wks-box); overflow-y: auto; overflow-x: hidden; position: relative;
    background: var(--w1wks-bg); color: var(--w1wks-ink); font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; scrollbar-width: thin; }
  /* On a normal page: delete height and overflow above, set --w1wks-box: 100vh, and in the script use root: null. */
  .w1wks:focus-visible { outline: 3px solid var(--w1wks-accent); outline-offset: -3px; }
  .w1wks-hint { position: sticky; top: 0; height: 0; z-index: 5; display: flex; align-items: flex-start; justify-content: flex-end; pointer-events: none; }
  .w1wks-hint span { margin: 12px 12px 0 0; padding: 5px 12px; border-radius: 999px; background: var(--w1wks-chip); color: var(--w1wks-chipink);
    font-size: 12px; letter-spacing: .04em; transition: opacity .5s ease; }
  .w1wks[data-touched] .w1wks-hint span { opacity: 0; }
  .w1wks-grid { max-width: 72rem; margin: 0 auto; padding: 0 32px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 0 56px; }
  .w1wks[data-side="left"] .w1wks-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  .w1wks-vis { grid-column: 2; grid-row: 1; align-self: start; position: sticky; top: 0; z-index: 1; height: var(--w1wks-box);
    box-sizing: border-box; padding: 28px 0; display: flex; align-items: center; justify-content: center; }
  .w1wks[data-side="left"] .w1wks-vis { grid-column: 1; }
  .w1wks[data-side="left"] .w1wks-col { grid-column: 2; }
  .w1wks-frame { position: relative; width: min(100%, calc((var(--w1wks-box) - 56px) * 1.3)); aspect-ratio: 1.3; overflow: hidden;
    border-radius: var(--w1wks-r, 18px); background: var(--w1wks-panel);
    box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 28px 56px -28px rgba(0,0,0,.35); }
  .w1wks-col { grid-column: 1; grid-row: 1; position: relative; z-index: 2; min-width: 0; }
  .w1wks-head { padding: 56px 0 8px; }
  .w1wks-eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--w1wks-accent); }
  .w1wks-h { margin: 12px 0 0; font-family: var(--w1wks-display); font-weight: var(--w1wks-dw, 600); font-size: clamp(1.75rem, 3.6vw, 2.6rem); line-height: 1.1; letter-spacing: -.02em; }
  .w1wks-lede { margin: 14px 0 0; max-width: 30rem; font-size: 1.0625rem; line-height: 1.6; color: var(--w1wks-soft); }
  .w1wks-steps { list-style: none; margin: 0; padding: 0 0 calc(var(--w1wks-box) * .42); }
  .w1wks-step { min-height: calc(var(--w1wks-box) * .62); display: flex; align-items: center; }
  .w1wks-card { box-sizing: border-box; width: 100%; padding: 22px 24px; border-radius: 14px; background: var(--w1wks-card); border: 1px solid var(--w1wks-line);
    opacity: .55; transition: opacity .45s ease; }
  .w1wks[data-step="1"] .w1wks-step[data-i="1"] .w1wks-card,
  .w1wks[data-step="2"] .w1wks-step[data-i="2"] .w1wks-card,
  .w1wks[data-step="3"] .w1wks-step[data-i="3"] .w1wks-card,
  .w1wks[data-step="4"] .w1wks-step[data-i="4"] .w1wks-card { opacity: 1; }
  .w1wks-when { margin: 0; font-size: .8125rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--w1wks-accent); }
  .w1wks-card h3 { margin: 6px 0 0; font-size: 1.375rem; line-height: 1.25; font-weight: 650; }
  .w1wks-card h3 + p { margin: 8px 0 0; font-size: 1rem; line-height: 1.6; color: var(--w1wks-soft); }
  .w1wks-end { max-width: 72rem; margin: 0 auto; padding: 48px 32px 64px; display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; justify-content: space-between; border-top: 1px solid var(--w1wks-line); }
  .w1wks-end p { margin: 0; font-size: 1.0625rem; }
  .w1wks-btn { display: inline-flex; min-height: 46px; align-items: center; padding: 0 22px; border-radius: 999px; background: var(--w1wks-accent);
    color: var(--w1wks-btnink); font-weight: 600; font-size: .9375rem; text-decoration: none; transition: transform .2s ease; }
  .w1wks-btn:hover { transform: translateY(-1px); }
  .w1wks-btn:focus-visible { outline: 3px solid var(--w1wks-ink); outline-offset: 3px; }
  /* Phones: the visual pins at the top and the steps scroll up over it on solid cards. */
  @media (max-width: 760px) {
    .w1wks-grid, .w1wks[data-side="left"] .w1wks-grid { grid-template-columns: minmax(0, 1fr); padding: 0 16px; }
    .w1wks-vis, .w1wks[data-side="left"] .w1wks-vis { grid-column: 1; grid-row: 2; height: 300px; padding: 12px 0; background: var(--w1wks-bg); }
    .w1wks-frame { width: min(100%, calc(272px * 1.3)); }
    .w1wks-col, .w1wks[data-side="left"] .w1wks-col { display: contents; }
    .w1wks-head { grid-row: 1; padding: 36px 0 4px; }
    .w1wks-steps { grid-row: 3; position: relative; z-index: 2; }
    .w1wks-step { min-height: calc(var(--w1wks-box) * .5); align-items: flex-end; }
    .w1wks-card { opacity: 1; box-shadow: 0 14px 34px -16px rgba(0,0,0,.4); }
    .w1wks-end { padding: 40px 16px 56px; }
  }
  /* Reduced motion: nothing pins, the steps read as a plain list and the visual shows its final state. */
  @media (prefers-reduced-motion: reduce) {
    .w1wks-vis, .w1wks[data-side="left"] .w1wks-vis { position: relative; height: auto; }
    .w1wks-step { min-height: 0; padding: 8px 0; }
    .w1wks-steps { padding-bottom: 32px; }
    .w1wks .w1wks-card { opacity: 1; }
    .w1wks *, .w1wks *::before { transition: none !important; }
  }
  .w1wks-frame { border: 1px solid var(--w1wks-line); }
  .w1wks-cal { position: absolute; inset: 0; padding: 6% 6%; display: grid; align-content: center; gap: 4.5%; container-type: inline-size; }
  .w1wks-row { display: grid; grid-template-columns: 22cqi 1fr; grid-template-rows: auto auto; gap: 4px 3cqi; align-items: center; }
  .w1wks-lab { margin: 0; grid-row: 1 / 3; display: grid; }
  .w1wks-lab b { font-family: Georgia, serif; font-weight: 400; font-size: clamp(14px, 4.6cqi, 22px); }
  .w1wks-lab span { font-size: clamp(10px, 2.6cqi, 12px); color: #5c6455; letter-spacing: .04em; }
  .w1wks-cells { display: grid; grid-template-columns: repeat(13, 1fr); gap: .9cqi; }
  .w1wks-cells i { aspect-ratio: 1; border-radius: 3px; background: #ece7da; position: relative; overflow: hidden; }
  .w1wks-cells i::after { content: ""; position: absolute; inset: 0; background: var(--w1wks-c); opacity: 0; transform: scale(.4);
    transition: opacity .35s ease var(--d), transform .5s cubic-bezier(.3,1.4,.5,1) var(--d); border-radius: 3px; }
  .w1wks-crop { margin: 0; font-size: clamp(10px, 2.6cqi, 13px); color: #50574a; opacity: 0; transition: opacity .4s ease .4s; }
  .w1wks-q1 { --w1wks-c: #7fa75a; } .w1wks-q2 { --w1wks-c: #d99a2b; } .w1wks-q3 { --w1wks-c: #b45a2a; } .w1wks-q4 { --w1wks-c: #5f7f95; }
  .w1wks[data-step="1"] .w1wks-q1 i::after, .w1wks[data-step="2"] .w1wks-q1 i::after, .w1wks[data-step="2"] .w1wks-q2 i::after,
  .w1wks[data-step="3"] .w1wks-row:not(.w1wks-q4) i::after, .w1wks[data-step="4"] .w1wks-row i::after { opacity: 1; transform: none; }
  .w1wks[data-step="1"] .w1wks-q1 .w1wks-crop, .w1wks[data-step="2"] .w1wks-q1 .w1wks-crop, .w1wks[data-step="2"] .w1wks-q2 .w1wks-crop,
  .w1wks[data-step="3"] .w1wks-row:not(.w1wks-q4) .w1wks-crop, .w1wks[data-step="4"] .w1wks-crop { opacity: 1; }
  @media (prefers-reduced-motion: reduce) { .w1wks .w1wks-cells i::after { transition: none; } }
</style>

<script>
(function () {
  var root = document.querySelector("[data-w1wks]");
  if (!root) return;
  var off = []; // cleanup list, used by the React version
  var SPEED = 100; // demo scroll in px per second until someone touches the box; 0 turns it off
  var MID = "-48% 0px -48% 0px"; // a step becomes active when it crosses the middle of the box
  var reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
  var steps = root.querySelectorAll("[data-i]"), lastStep = steps[steps.length - 1].getAttribute("data-i");
  function on(el, n, f) { el.addEventListener(n, f, { passive: true }); off.push(function () { el.removeEventListener(n, f); }); }
  function set(i) {
    if (root.getAttribute("data-step") === i) return;
    root.setAttribute("data-step", i);
  }
  if (reduce) set(lastStep);
  else {
    // Which step is active: one observer on the nearest scroller. For a section on a normal page use root: null.
    var io = new IntersectionObserver(function (es) {
      es.forEach(function (e) { if (e.isIntersecting) set(e.target.getAttribute("data-i")); });
    }, { root: root, rootMargin: MID });
    steps.forEach(function (s) { io.observe(s); });
    off.push(function () { io.disconnect(); });
    // Slow demo scroll so the preview moves; any wheel, touch, click or key hands control back.
    var frame = 0, t0 = 0, pos = 0, seen = true, done = !SPEED;
    var tick = function (t) {
      pos += t0 ? SPEED * Math.min(t - t0, 50) / 1000 : 0;
      t0 = t;
      if (pos >= root.scrollHeight - root.clientHeight) pos = 0;
      root.scrollTop = pos;
      frame = requestAnimationFrame(tick);
    };
    var play = function () { if (!done && seen && !frame) { t0 = 0; frame = requestAnimationFrame(tick); } };
    var stop = function () { cancelAnimationFrame(frame); frame = 0; };
    off.push(stop);
    var vis = new IntersectionObserver(function (e) { seen = e[0].isIntersecting; if (seen) play(); else stop(); });
    vis.observe(root);
    off.push(function () { vis.disconnect(); });
    ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (n) {
      on(root, n, function () { done = true; stop(); root.setAttribute("data-touched", ""); });
    });
    play();
  }
})();
</script>

With reduced motion: All four rows are filled from the start, each with its crops, next to the four seasons as a list.

Running cost: Fifty-two small squares fade and scale in with CSS transitions, only when their season's step becomes active.

  • Recolour a season with `--w1wks-c` on `.w1wks-q1` to `.w1wks-q4`.
  • Change the ripple across a row with the `--d` delay on each square (0.035s per week).
  • Write your own produce into each `.w1wks-crop` line under its row.

Performance notes

Nothing is measured while scrolling. One IntersectionObserver per section reports which step crosses the middle of the box, and the script only swaps a data attribute, so all the movement is CSS transitions on transform and opacity that the browser runs on the compositor.

Every state of the visual is drawn up front and hidden with opacity, rather than built when its step arrives, so a fast scroll never waits on new images. Photos are sized to the pinned frame and loaded lazily when the section is below the first screen.

Questions

What is scrollytelling?

A way of telling a story on a web page where scrolling moves the narrative forward. Usually one picture stays fixed while text steps scroll beside or over it, and each step changes the picture.

Do I need a library for scrollytelling?

No. Sticky positioning keeps the visual in place and IntersectionObserver tells you which step is in view. Both work in every current browser, and together they replace what scrollytelling libraries mainly provide.

How does scrollytelling work on phones?

There is rarely room for text beside a picture, so the pieces here put the pinned visual at the top of the screen and let the steps scroll up over its lower edge on a solid card, which keeps the text readable.

Is a scroll story accessible?

It can be. Keep every step as real text in order, never put information only in the picture, give the visual a text alternative that covers all its states, and show the steps as a plain sequence when reduced motion is on.

More collections: Scroll Animations Without a Library, Stacking Cards on Scroll, Horizontal Scroll Sections. All scroll effects. Build your site free to have a full site built around them.

Product

Who It's For

Features

Resources

Company

View Sitemap