Skip to content

Commit

Permalink
Merge pull request #174 from kube-logging/sidebar-scroll-fix
Browse files Browse the repository at this point in the history
Adds automatic scrolling to toc
  • Loading branch information
fekete-robert authored Aug 14, 2023
2 parents 0b68b80 + 547de53 commit fc56fd8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions layouts/partials/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,14 @@
</script>
{{ end }}

<!-- Scroll left-side toc to current entry, from https://github.com/google/docsy/issues/348 -->
<script>
(function() {
var a = document.querySelector("#td-section-nav");
addEventListener("beforeunload", function(b) {
localStorage.setItem("menu.scrollTop", a.scrollTop)
}), a.scrollTop = localStorage.getItem("menu.scrollTop")
})()
</script>

{{ partial "hooks/body-end.html" . -}}

0 comments on commit fc56fd8

Please sign in to comment.