From 51c9ed35110de86ad32c95938802121fe7ba6cd8 Mon Sep 17 00:00:00 2001 From: Thedro Neely Date: Tue, 19 Apr 2022 00:41:36 -0400 Subject: public/js/app: Anchor on DOM load --- public/js/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'public') diff --git a/public/js/app.js b/public/js/app.js index cbf5f07..e8d8934 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -26,13 +26,13 @@ url = window.location.href.split('#')[0]; */ var settings = { pager: {} }; -window.addEventListener('load', function(event) { +window.addEventListener('DOMContentLoaded', function(event) { if (history.scrollRestoration) { history.scrollRestoration = 'manual'; } if (localStorage['settings']) { settings = JSON.parse(localStorage['settings']); } if (window.location.href.indexOf("#") >= 0) { settings['pager'][url] = window.pageYOffset; localStorage['settings'] = JSON.stringify(settings); - document.getElementById(location.hash.slice(1)).scrollIntoView() + document.getElementById(location.hash.slice(1)).scrollIntoView(); return; } if (settings['pager'][url] > 0) { window.scrollTo(0, settings['pager'][url]); return; } -- cgit v1.2.3