refactor(smoothscroll, anchoring): use pushState instead of replaceState when updating browser history
This commit is contained in:
parent
4406726b16
commit
1d44d258b5
1 changed files with 1 additions and 1 deletions
2
app/dist/scripts/app.js
vendored
2
app/dist/scripts/app.js
vendored
|
@ -36,7 +36,7 @@ document.querySelectorAll("a[href^='#']").forEach(anchor => {
|
||||||
if (document.getElementById(element)) {
|
if (document.getElementById(element)) {
|
||||||
elementOffset = document.getElementById(element).offsetTop - 74;
|
elementOffset = document.getElementById(element).offsetTop - 74;
|
||||||
window.scroll({ top: elementOffset, behavior: "smooth" });
|
window.scroll({ top: elementOffset, behavior: "smooth" });
|
||||||
history.replaceState({}, "", `#${element}`); // Add hash to URL bar
|
history.pushState({}, "", `#${element}`); // Add hash to URL bar
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue