Closed PiXy79 closed 4 years ago
onMount(() => window.scrollTo(0, 0))
Yeah, the previous suggestion would work but also you can subscribe to any route change:
import { router } from 'yrv';
router.subscribe(() => {
window.scrollTo(0, 0);
});
@pateketrueke Thanks, I have subscribed to any router change and it works perfectly.
@pateketrueke @PiXy79
Is it called two times when I first open the page, right?
Is it called two times when I first open the page, right?
It can be called many times, it depends on the svelte reactivity tracking and your application state, etc.
But if you ask me it should fire when effective changes are made only, can you save a REPL to show the exact use-case you're describing?
Hi, thank you for fixed the latest issues relating to babel and IE11 !!! I have only an issue, using your library. I'm using directly the
Link
component with only a href parameter. If I have a link at the bottom of a page/component, when I load the new route the scrollbar remains on bottom instead of positioning on top. Probably I'm missing something but there is a possibility to scroll on top after a route update, without reloading a page completely?Thanks in advance !