hugo-book/layouts/partials/docs/menu.html

25 lines
644 B
HTML
Raw Normal View History

<nav>
2019-01-24 22:30:31 +00:00
{{ partial "docs/brand" . }}
2019-07-15 16:25:21 +00:00
{{ partial "docs/search" . }}
2019-01-24 22:30:31 +00:00
{{ partial "docs/inject/menu-before" . }}
{{ if .Site.Params.BookMenuBundle }}
{{ partial "docs/menu-bundle" . }}
{{ else }}
{{ partial "docs/menu-filetree" . }}
{{ end }}
{{ partial "docs/inject/menu-after" . }}
</nav>
2019-07-15 16:25:21 +00:00
<!-- Restore menu position as soon as possible to avoid flickering -->
<script>
(function() {
var menu = document.querySelector("aside.book-menu nav");
addEventListener("beforeunload", function(event) {
localStorage.setItem("menu.scrollTop", menu.scrollTop);
});
menu.scrollTop = localStorage.getItem("menu.scrollTop");
})();
</script>