0👍
Your page needs to have enough content for scrollTop
or scrollIntoView
to be able to work.
Most likely there’s nothing after the div, so the page cannot scroll.
Add some more content and you’ll see the content move.
- [Vuejs]-VueJS view changes doesnt reflect in laravel Xampp
- [Vuejs]-How to properly configure my backend in order to receive data from my form? I'm using Vue.js
0👍
ok, i found out it is not vue/nuxt problem. the container got auto scroll properties. so that is why it is not working.thanks
- [Vuejs]-How should I be referencing firebase data in Vue component?
- [Vuejs]-VueJs component not showing in page (using Laravel framework)
0👍
This worked for me in any component without ref (but it only scrolls to top), smooth scrolling is default behavior
<button @click=scrollToTop()>Jump to top of page
methods: {
scrollToTop() {
window.scrollTo({ top: 0 });
}
}
Source:stackexchange.com