Share Posted May 12 Sometimes, when I reload the page, the website scrolls back to top. If I remove scrolltrigger it is working fine. Any idea where is the problem? Website url: https://native.doktorklain.cz/multifokaly. I am using latest Sveltekit and Gsap. scrolltrigger (2).mov Link to comment Share on other sites More sharing options...
Author Share Posted May 12 I found out, that the same problem is at other people projects as well - like https://github.com/firasel/Gsap-Animation Link to comment Share on other sites More sharing options...
Share Posted May 12 Hi @Bitworks and welcome to the GreenSock forums! Maybe you could try ScrollTrigger.clearScrollMemory() method: https://greensock.com/docs/v3/Plugins/ScrollTrigger/static.clearScrollMemory() If you keep having issues, please provide a minimal demo. You can fork this starter template: https://stackblitz.com/edit/sveltejs-kit-template-default-unljf6 Hopefully this helps. Happy Tweening! Link to comment Share on other sites More sharing options...
Author Share Posted May 13 Thank you @Rodrigo! I will try the clearScrollMemory and also I will prepare the demo - but it seeems that it is doing this only after build (not in npm run dev). Also I found out that it is working good in gsap@3.11.1, but doing this problem in gsap@3.11.2 and newer. Link to comment Share on other sites More sharing options...
Solution Author Solution Share Posted May 14 I tried to build and preview the minimal demo and the problem is the same (see the video). I had to slow down the loading using throttling so I can see it more often. So I added ScrollTrigger.clearScrollMemory(); to the top of the page and it is working fine! 🎉 So thank you for help @Rodrigo // prevent scroll jump problem on reload import { gsap } from 'gsap/dist/gsap'; import { ScrollTrigger } from 'gsap/dist/ScrollTrigger'; ScrollTrigger.clearScrollMemory(); svelte2.mp4 2 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