kaique Posted April 15, 2022 Share Posted April 15, 2022 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> Link to comment Share on other sites More sharing options...
Solution Cassie Posted April 15, 2022 Solution Share Posted April 15, 2022 Hey there! This thread should help. I'm afraid we can't help with nuxt-gsap-module though as it's a third party tool. Good luck! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now