Hi all.
Thank you for this post. I did a small plugin that works for me with Nuxt 3, I use this module for loading gsap: @hypernym/nuxt-gsap
export default defineNuxtPlugin((nuxtApp) => {
let scrollSmoother = null
const initScrollSmoother = () => {
scrollSmoother = nuxtApp.$ScrollSmoother.create({
smooth: 1,
effects: true,
smoothTouch: 0.1,
});
}
initScrollSmoother()
nuxtApp.hook('page:transition:finish', () => {
scrollSmoother.kill()
initScrollSmoother()
})
})
The plugin is client side only (smoothScroll.client.js).
Hope this helps