Dot Contents
Point it at an article and it lists the headings (giving them ids if they've none). Beside the list, a rail of dots: each heading a stop, and a marker that eases from one to the next in step with the section you're in, the read part lit. The section you're in is marked, a click scrolls there, and under it sits how many minutes of reading are left. It's a nav of real links, and it works with the window or any scrolling box.
Needs: None. Canvas 2D.
Customize
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| target | string | "article" | CSS selector for the article whose headings it lists. |
| levels | number[] | null | Which heading levels to list. [2, 3] by default. |
| scroller | string | HTMLElement | – | The element that scrolls, when it isn't the window. |
| offset | number | 96 | How far below the top of the view a heading counts as reached, in px. |
| title | string | "On this page" | The small heading above the list. Empty for none. |
| timeLeft | boolean | true | Show the minutes of reading left. |
| wpm | number | 230 | Reading speed for the time left, words a minute. |
| tone | string | – | The rail's colour. The page's accent by default. |
| className | string | – | Class on the nav. |
| style | CSSProperties | – | Style on the nav. |