diff options
| author | user <user@clank> | 2026-08-30 19:20:21 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-30 19:20:21 +0200 |
| commit | 37e1cdd6e0ad528b3f1c2efe366dc1d7f4ca8f17 (patch) | |
| tree | 601b1cdfae5f5130e9b2ea25f916e5d927b18441 | |
| parent | web: a step's title is a road to the step (diff) | |
| download | slosh-37e1cdd6e0ad528b3f1c2efe366dc1d7f4ca8f17.tar.gz slosh-37e1cdd6e0ad528b3f1c2efe366dc1d7f4ca8f17.tar.xz slosh-37e1cdd6e0ad528b3f1c2efe366dc1d7f4ca8f17.zip | |
web: the tour magnets, politely
scroll-snap-type: y proximity on the root, snap-align: center on the
steps and nothing else: a scroll that ends near a step is settled onto
its centre -- the exact spot the tour activates it, so the rest
position and the lit step agree -- and momentum, half-reads and every
snapless section are left alone, by spec. Proximity, never mandatory:
the mandatory kind on a page that also has prose is a trap, and the
JS kind is worse. Off in the one-column layout, where the sticky
stage covers the upper viewport and a centred step would sit half
beneath it.
| -rw-r--r-- | web/site.css | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/web/site.css b/web/site.css index 5b280d5..21601e2 100644 --- a/web/site.css +++ b/web/site.css @@ -24,7 +24,14 @@ * { box-sizing: border-box; } -html { scroll-behavior: smooth; } +html { + scroll-behavior: smooth; + /* Proximity, never mandatory: the browser magnets a stop landing *near* a + * step onto its centre -- which is the tour's activation point, so the + * rest position and the lit step agree -- and leaves momentum, half-reads + * and every section without a snap-align entirely alone. */ + scroll-snap-type: y proximity; +} body { margin: 0; @@ -441,6 +448,7 @@ section > p:last-child { margin-bottom: 0; } justify-content: center; opacity: 0.3; transition: opacity 0.25s; + scroll-snap-align: center; /* see the html rule: the magnet's targets */ } .step.active { opacity: 1; } @@ -483,6 +491,9 @@ section > p:last-child { margin-bottom: 0; } * .stage-pin's parent is only as tall as the player, so a sticky inside it * has nowhere to stick; .scrolly-stage is bounded by the whole tour. */ .scrolly { display: block; margin-top: 0; margin-bottom: 0; pointer-events: auto; } + /* One column: the sticky stage covers the upper part of the viewport, so + * a centre-snapped step would sit half beneath it. No magnet here. */ + html { scroll-snap-type: none; } .scrolly-stage { position: sticky; top: 0; |
