diff options
author | Thedro Neely <thedroneely@gmail.com> | 2020-04-20 19:24:15 -0400 |
---|---|---|
committer | Thedro Neely <thedroneely@gmail.com> | 2020-04-20 19:24:15 -0400 |
commit | b0bb275d90e7958ce4469711665aa543170f575e (patch) | |
tree | 81bd7974a2655cb526b522dd9c476ea58212bec8 /public/js/app.js | |
parent | 1f4d61f3062edff549f2e39200e4f29940e91c4f (diff) | |
download | thedroneely.com-b0bb275d90e7958ce4469711665aa543170f575e.tar.gz thedroneely.com-b0bb275d90e7958ce4469711665aa543170f575e.tar.bz2 thedroneely.com-b0bb275d90e7958ce4469711665aa543170f575e.zip |
public/js/app: Add window event listener
Diffstat (limited to 'public/js/app.js')
-rw-r--r-- | public/js/app.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/public/js/app.js b/public/js/app.js index 3ccbcd7..be51fbf 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -24,9 +24,9 @@ window.history.replaceState(null, null, url); */ var settings = { pager: {} }; -window.onload = function () { +window.addEventListener('load', function(event) { if (settings['pager'][window.location.href]) { window.scrollTo(0, settings['pager'][window.location.href]); } -}; +}); settings['pager'][window.location.href] = window.pageYOffset; @@ -112,10 +112,10 @@ var dropdownInputList = byClass(document, 'dropdown-input'); var dropdownContentList = byClass(document, 'dropdown-content'); var dropdownMenuList = byClass(document, 'dropdown'); -window.onscroll = function() { +window.addEventListener('scroll', function(event) { -settings['pager'][window.location.href] = window.pageYOffset; -localStorage['settings'] = JSON.stringify(settings); + settings['pager'][window.location.href] = window.pageYOffset; + localStorage['settings'] = JSON.stringify(settings); dropdownHide(dropdownInputList); @@ -134,7 +134,7 @@ localStorage['settings'] = JSON.stringify(settings); previousPosition = currentPosition; scrollReady = 1; -}; +}); /** * Medium Zoom 1.0.4 |