Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Best way to eliminate scroll to top on route change #989
I have a problem where scrolling to the top of the page on route changes is not desired.
I'm using hash routing. The left side of the page contains a list of items that grows using infinite scroll. The right side of the page is displayed in a fixed position so that it is always visible. Clicking on an item on the left of the page changes the hash, which updates the right side of the page. Unfortunately, the function setScroll scrolls the page to the top, so the user looses their place.
My temporary work around is to redefine the window.scrollTo function to do nothing before adding mithril to the page, and then restoring the scrollTo function after mithril has been created. Definite kludge. Any better ideas?