I found out that scrolling to an anchor works wonderfully, however breaking the browser's back button's functionality (Chromium, Firefox, Safari Mobile).
After commenting out the below, the back button works, however not scrolling smoothly.
I was trying onpopstate and different onpushstate variants to have it scroll smoothly to the top again, upon clicking the back button, but wasn't able to do so. If you have an idea, I'd appreciate it.
const complete = (hash, coordinates) => {
//history.pushState(null, null, hash);
root.scrollTop = coordinates.get("start") + coordinates.get("delta");
};
const attachHandler = (links, index) => {
const link = links.item(index);
link.addEventListener("click", event => {
//event.preventDefault();
scroll(link);
});
I found out that scrolling to an anchor works wonderfully, however breaking the browser's back button's functionality (Chromium, Firefox, Safari Mobile).
After commenting out the below, the back button works, however not scrolling smoothly.
I was trying onpopstate and different onpushstate variants to have it scroll smoothly to the top again, upon clicking the back button, but wasn't able to do so. If you have an idea, I'd appreciate it.