diff options
author | Alex Shpak <alex-shpak@users.noreply.github.com> | 2019-07-15 18:25:21 +0200 |
---|---|---|
committer | Alex Shpak <alex-shpak@users.noreply.github.com> | 2019-08-06 11:33:42 +0200 |
commit | dda0a0eab19457598b71f2b2b2f978b09d3f95c7 (patch) | |
tree | 035ca254fe7a8c7c7df316bce0b777f9a9dd06fe /layouts/partials/docs/menu.html | |
parent | b199d72e5fd7ec76b3c17fc9a6368868978d6328 (diff) |
Start work on search feature with lunr
Diffstat (limited to 'layouts/partials/docs/menu.html')
-rw-r--r-- | layouts/partials/docs/menu.html | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/layouts/partials/docs/menu.html b/layouts/partials/docs/menu.html index d280713..6a72ac9 100644 --- a/layouts/partials/docs/menu.html +++ b/layouts/partials/docs/menu.html @@ -1,5 +1,6 @@ <nav> {{ partial "docs/brand" . }} +{{ partial "docs/search" . }} {{ partial "docs/inject/menu-before" . }} {{ if .Site.Params.BookMenuBundle }} @@ -11,6 +12,13 @@ {{ partial "docs/inject/menu-after" . }} </nav> -{{ if .Site.Params.BookEnableJS }} - {{ template "jsmenu" . }} -{{ end }} +<!-- 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> |