Compare commits
2 commits
180832b84c
...
06eecff942
| Author | SHA1 | Date | |
|---|---|---|---|
| 06eecff942 | |||
| 9b0debd0ba |
3 changed files with 10 additions and 4 deletions
|
|
@ -2,10 +2,6 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta
|
||||
name="generator"
|
||||
content="HTML Tidy for HTML5 for Apple macOS version 5.8.0"
|
||||
/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>The Tough Guide to Fantasyland</title>
|
||||
<link rel="stylesheet" href="style.css" inline />
|
||||
|
|
|
|||
|
|
@ -52,6 +52,15 @@ Array.from(firstByLetter.entries())
|
|||
tocLetters?.appendChild(link);
|
||||
});
|
||||
|
||||
// scroll TOC list when clicking a letter
|
||||
tocLetters?.addEventListener("click", (e) => {
|
||||
if (e.target.tagName !== "A") return;
|
||||
const href = e.target.getAttribute("href");
|
||||
if (!href) return;
|
||||
const tocLink = tocList?.querySelector(`a[href="${href}"]`);
|
||||
tocLink?.scrollIntoView({ block: "start" });
|
||||
});
|
||||
|
||||
const searchInput = document.getElementById("toc-search");
|
||||
let searchTimeout;
|
||||
searchInput?.addEventListener("input", (event) => {
|
||||
|
|
|
|||
|
|
@ -140,6 +140,7 @@ body {
|
|||
padding: 6px 8px;
|
||||
border-radius: 10px;
|
||||
display: block;
|
||||
scroll-margin-top: 1rem;
|
||||
transition:
|
||||
background 0.2s ease,
|
||||
color 0.2s ease;
|
||||
|
|
|
|||
Loading…
Reference in a new issue