_rancaHoratiu
vue-smooth-scroll on nuxt3?
Global:
const app = createApp(...)
app.use(VueSmoothScroll, {
duration: 400,
updateHistory: false
})
Directive:
<div id="container">
<a href="#div-id" v-smooth-scroll="{ duration: 1000, offset: -50, container: '#container' }">Anchor</a>
<div id="div-id"></div>
</div>
Programmatic:
this.$smoothScroll({
scrollTo: this.$refs.myEl,
duration: 1000,
offset: -50,
})
Programmatic (in Vue3 setup):
const smoothScroll = Vue.inject('smoothScroll')
smoothScroll({
scrollTo: refs.myEl,
duration: 1000,
offset: -50,
})
7 replies