Hello guys, I'm trying to use scrollSmoother on a Nuxt app and it works fine on the first mount, however if I change route and get back it doesn't work anymore, is there any kind of .kill or .update that I have to do? Also using the nuxt-gsap-module
Cheers,
Kaique
<template lang="pug">
main#smooth-wrapper(v-if="!isLoading")
NuxtLink(to="/")
span.hide go index
ul
li(v-for="image in $data.imagesToPreload")
img.hide(:src=`image`)
</template>
<script>
export default {
mounted() {
const images = this.imagesToPreload.map(imageSrc => {
return new Promise((resolve, reject) => {
const img = new Image()
img.src = imageSrc
img.onload = resolve
img.onerror = reject
})
})
Promise.all(images).then(() => {
this.isLoading = false
}),
this.$ScrollSmoother.create({
smooth: 1.6
})
},
data() {
return {
isLoading: true,
imagesToPreload: [
"https://placeimg.com/1280/800/any"
]
}
}
}
</script>