diff options
author | Thedro Neely <thedroneely@gmail.com> | 2022-04-19 00:41:36 -0400 |
---|---|---|
committer | Thedro Neely <thedroneely@gmail.com> | 2022-04-19 00:41:36 -0400 |
commit | 51c9ed35110de86ad32c95938802121fe7ba6cd8 (patch) | |
tree | e0ef75e2436a868e0cf310fbd28dc8f43040caad /public | |
parent | b0488a1d5401bafcb9b780a0f08ae5205f1f3278 (diff) | |
download | thedroneely.com-51c9ed35110de86ad32c95938802121fe7ba6cd8.tar.gz thedroneely.com-51c9ed35110de86ad32c95938802121fe7ba6cd8.tar.bz2 thedroneely.com-51c9ed35110de86ad32c95938802121fe7ba6cd8.zip |
public/js/app: Anchor on DOM load
Diffstat (limited to 'public')
-rw-r--r-- | public/js/app.js | 4 |
1 files changed, 2 insertions, 2 deletions
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; } |