From 7df53f201527fa571935da0ea9b60a76f466d388 Mon Sep 17 00:00:00 2001 From: Mahyar Iranibazaz Date: Mon, 23 Oct 2023 04:04:21 +0800 Subject: [PATCH] update: use sessionStorage instead of localStorage --- src/assets/js/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/assets/js/main.js b/src/assets/js/main.js index 0c069f7..6e658c2 100644 --- a/src/assets/js/main.js +++ b/src/assets/js/main.js @@ -1,10 +1,10 @@ window.addEventListener('scroll', function () { if (document.getElementsByClassName('keep-scroll').length) { - localStorage.top = window.scrollY; + sessionStorage.top = window.scrollY; } }) window.addEventListener('load', function () { if (document.getElementsByClassName('keep-scroll').length) { - window.scrollTo({top: localStorage.top || 0, behavior: 'smooth'}); + window.scrollTo({top: sessionStorage.top || 0, behavior: 'smooth'}); } }) \ No newline at end of file