By default, page navigation in Nuxt.js 3 scrolls to the top.

Hi Devs,
I'm facing an issue in Nuxt.js. When I scroll to the bottom of a page and navigate to another page, the scroll position resets to the top. I want the page to always start from the top, no matter where I scrolled. How can I prevent this default scroll behavior? i have tried many time but not get proper solution.
Solution
i have fixed it - import type { RouterConfig } from "@nuxt/schema";

export default <RouterConfig>{
scrollBehavior(to, from, savedPosition) {
if (savedPosition) {
return savedPosition;
}
return { top: 0, behavior: "instant" };
},
};
Was this page helpful?