Skip to content

Commit

Permalink
Updates from daniil - now scriptless.
Browse files Browse the repository at this point in the history
  • Loading branch information
mstensho committed Jul 17, 2024
1 parent 2858a26 commit 9430078
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions toc-demo-Jul2024.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
bottom: 40px;
}

.sc section {
scroll-snap-align: center;
}

section::before {
display: block;
font-size: 1.7em;
Expand All @@ -36,7 +40,7 @@
}

section::scroll-marker {
cursor: grab;
cursor: pointer;
font-family: sans-serif;
display: block;
content: attr(title);
Expand All @@ -46,7 +50,7 @@
padding: 2px;
background: #ccc;
}
section:hover::scroll-marker {
section::scroll-marker:focus {
font-weight: bold;
}
</style>
Expand Down Expand Up @@ -174,11 +178,3 @@
</section>
</div>
</div>
<script>
document.querySelectorAll("section").forEach(elm => {
elm.addEventListener("click", (e) => {
let rect = e.currentTarget.getBoundingClientRect();
sc.scrollTo(rect.left + sc.scrollLeft, rect.top + sc.scrollTop);
});
});
</script>

0 comments on commit 9430078

Please sign in to comment.