aboutsummaryrefslogtreecommitdiff
path: root/static/js/pager.ts
diff options
context:
space:
mode:
Diffstat (limited to 'static/js/pager.ts')
-rw-r--r--static/js/pager.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/static/js/pager.ts b/static/js/pager.ts
index e818d17..3f7279c 100644
--- a/static/js/pager.ts
+++ b/static/js/pager.ts
@@ -17,7 +17,7 @@
const link = function () { url = self.location.href.split("#")[0].split("?")[0]; };
- const scrollHash = function (url, load = false) {
+ const scrollHash = function (url) {
const hash = self.location.hash;
const fragment = hash.slice(1) && document.getElementById(hash.slice(1));
const fragmented = hash.length > 0;
@@ -25,7 +25,9 @@
if (hashed) {
self.location.hash = hash;
self.location.href = hash;
- if (load) fragment.scrollIntoView();
+ if ("scroll-margin-top" in document.body.style === false && fragment.textContent !== "") {
+ self.scrollBy(0, -6 * parseFloat(getComputedStyle(document.documentElement).fontSize));
+ }
}
return hashed;
};