⚠️ You are looking at the english version of the page. Help us translate it here.
Want to take a look at our new docs? Our new docs are now in beta. Have fun!

The scrollToTop Property

The scrollToTop property lets you tell Nuxt.js to scroll to the top before rendering the page.

  • Type: Boolean (default: false)

By default, Nuxt.js scrolls to the top when you go to another page, but with children routes, Nuxt.js keeps the scroll position. If you want to tell Nuxt.js to scroll to the top when rendering your child route, set scrollToTop to true:

<template>
  <h1>My child component</h1>
</template>

<script>
  export default {
    scrollToTop: true
  }
</script>

Conversely, you can manually set scrollToTop to false on parent routes as well.

If you want to overwrite the default scroll behavior of Nuxt.js, take a look at the scrollBehavior option.

Contributors

Contribution for this page is now closed. If you would like to contribute please check out our new docs are now in beta. Have fun!

Platinum Sponsors

StoryblokMoovweb Support Us