From c0bd5b5bb899343ef8b18cceec1982ab8980b236 Mon Sep 17 00:00:00 2001 From: Alex Shpak Date: Tue, 4 Feb 2020 22:24:36 +0100 Subject: #90, Move inline scripts to file in assets to allow overwrite --- assets/menu-reset.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 assets/menu-reset.js (limited to 'assets/menu-reset.js') diff --git a/assets/menu-reset.js b/assets/menu-reset.js new file mode 100644 index 0000000..f3b90c5 --- /dev/null +++ b/assets/menu-reset.js @@ -0,0 +1,7 @@ +(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"); +})(); -- cgit v1.2.3