mfco Posted June 2, 2022 Share Posted June 2, 2022 Hi all, I am experiencing an issue in my current project related to getting and using the progress in the onUpdate callback used in ScrollSmoother function. I've created a simple codepen example that shows the same error in the console:Uncaught TypeError: Cannot read properties of undefined (reading 'animation') Everything works fine in FireFox and Safari, but am experiencing in Edge and Chrome. Any suggestions to a fix would be greatly appreciated. Please let me know if you need any additional information. Thanks! See the Pen 8dc3d5d5c3c972e1c641fe547466192b by pma4life (@pma4life) on CodePen Link to comment Share on other sites More sharing options...
Solution GreenSock Posted June 2, 2022 Solution Share Posted June 2, 2022 Good catch! Sorry about the confusion there - it would only happen when calling the constructor initially because the ScrollSmoother's ScrollTrigger hasn't been assigned yet. It's easy to work around for now, but we'll add code internally in the next release to resolve it without the workaround: // just make sure the .scrollTrigger property exists... onUpdate: self => console.log("progress", self.scrollTrigger ? self.progress : 0); 3 Link to comment Share on other sites More sharing options...
mfco Posted June 2, 2022 Author Share Posted June 2, 2022 Thank you Jack for the wickedly quick response! That check did the trick! 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