Jump to content
Search Community

ScrollSmoother self.progress error in chromium based browsers

mfco test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

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

  • Solution

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);

 

  • Like 3
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...