refactor(smoothscroll, anchoring): use pushState instead of replaceState when updating browser history

This commit is contained in:
Wick 2019-01-25 18:57:58 +01:00
parent 4406726b16
commit 1d44d258b5

View file

@ -36,7 +36,7 @@ document.querySelectorAll("a[href^='#']").forEach(anchor => {
if (document.getElementById(element)) {
elementOffset = document.getElementById(element).offsetTop - 74;
window.scroll({ top: elementOffset, behavior: "smooth" });
history.replaceState({}, "", `#${element}`); // Add hash to URL bar
history.pushState({}, "", `#${element}`); // Add hash to URL bar
}
});
});