Scrolling back to top slowly using Vuetify
Using the behavior
option triggers an animated scroll in browsers that support it.
window.scrollTo({
top: 0,
left: 0,
behavior: 'smooth'
});
https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo
try (open snippet on full-page)
html {
scroll-behavior: smooth;
}
function scrollme(selector) {
console.log('xx');
document.querySelector(selector).scrollIntoView();
}
html {
scroll-behavior: smooth;
}
.d { width: 100px; height: 1000px; background: #eee; }
.d:nth-child(odd) {background: #ddd; height: 100px; }
<div class="d start"></div>
<button onclick="scrollme('.end')">scroll</button>
<div class="d"></div>
<div class="d"></div>
<div class="d"></div>
<button onclick="scrollme('.start')">scroll</button>
<div class="d end"></div>