🐛 Fix: bookmark scroll error when scroll top equal 0

This commit is contained in:
Cell
2022-09-17 18:45:19 +08:00
parent b236c27820
commit 4684f6a429
3 changed files with 3 additions and 4 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -2
View File
@@ -1018,8 +1018,7 @@ class FixIt {
return;
}
window.addEventListener('beforeunload', () => {
const scrollTop = this.util.getScrollTop();
scrollTop && window.localStorage?.setItem(`fixit-bookmark/#${location.pathname}`, scrollTop);
window.localStorage?.setItem(`fixit-bookmark/#${location.pathname}`, this.util.getScrollTop());
});
const scrollTop = Number(window.localStorage?.getItem(`fixit-bookmark/#${location.pathname}`));
// If the page opens with a specific hash, just jump out