Repository navigation
Scroll position on page transition #13499
|
Hello, I can see the default behaviour in SvelteKit is to scroll to the top of the page when navigating, which is great. But when implementing a transition, it seems to do this immediately on both the Thanks. |
Replies: 1 comment
|
Both views share the window scroll position while the fade runs. For links using that transition, try |
Both views share the window scroll position while the fade runs. For links using that transition, try
data-sveltekit-noscroll, then callwindow.scrollTo({ top: 0 })after the outgoing animation finishes. If both views must remain visible at different scroll positions, give them separate scroll containers or capture the outgoing view with a view transition. Keep normal restoration for back and forward navigation.SvelteKit navigation API