StealThis .dev

Wiki — Sticky TOC + Scrollspy

A clean knowledge-base article layout for the fictional Aurora DB storage engine, pairing a readable serif body column with a sticky right-rail table of contents. The TOC is generated from the article headings, nests h3 anchors under their h2 sections, and highlights the section you are reading via an IntersectionObserver, auto-scrolling to keep the active entry in view. A top reading bar and a TOC meter track scroll depth, clicks smooth-scroll and move focus, and the rail collapses on narrow screens. Built with Inter, Source Serif 4 and vanilla JS only.

Buka di Lab
html css vanilla-js
Targets: JS HTML

Code

Sticky TOC + Scrollspy

A complete knowledge-base reading view for Aurora DB, a fictional distributed database, laid out in a crisp white docs palette with a persistent left sidebar, a centered serif body column capped at a comfortable measure, and a sticky right-rail table of contents. The article runs through real-feeling technical sections — the write path, on-disk segment format, compaction, recovery and tuning — with headings, code blocks, tables, callouts and keyboard hints.

The TOC builds itself from the article’s h2 and h3 elements, nesting sub-headings under their parent sections. As you scroll, an IntersectionObserver watches every heading and highlights the one that currently owns the viewport; the rail auto-scrolls so the active entry never drifts out of sight. A thin progress bar across the top of the page and a matching meter in the TOC both track overall reading position.

Clicking a TOC entry smooth-scrolls to its section and moves keyboard focus there for accessibility, updating the URL hash as it goes. A back-to-top link fades in once you are well into the page, the left nav collapses into a drawer below 820px, and shortcuts (/ to search, T to jump to the top) round it out. Everything runs on vanilla JS — no frameworks, no build step, and reduced-motion preferences are respected.

Illustrative UI only — fictional articles, products, and data.