Jump to content

Freehand Sam

JS Error with NPM GSAP-Trial Version of SmoothScroller on data-lag attributes

Recommended Posts

Hello. I'm just starting to play around with SmoothScroller and have run into an issue I can't seem to make sense of. Setting lag via a data attribute, as in data-lag=".05", creates a JS error and breaks all GSAP. See screenshot for console. Although data-speed works perfectly fine on the same div. In fact, I realized adding data-speed="1" will actually create data-lag="1" upon inspection of the code. But adding the data-lag attribute in my <div> myself breaks it. Obviously, your demos on CodePen work fine with the same basic setup. So I wondered if maybe there's a bug in the trial version available via NPM (https://www.npmjs.com/package/gsap-trial)?  I've stripped away all my other GSAP code (I've got some scrolltriggers), gone to bare bones html and css, and nothing fixes the error. So I'm only left to think it's in the plugin. 

Is there any way to test that exact same version of SmoothScroller.js on the NPM trial in CodePen so I can be in a completely clean environment but use the exact same version of the plugin? I will become a member and get the real SmoothScroller as soon as I am sure it will all work as the client wants and they approve it :) I just want to make sure there's not something inherently wrong with my whole setup first.


Link to comment
Share on other sites

Totally understandable that you want to try things out first to make sure it works for you. No problem - that's what the gsap-trial package is for. 


That error indicates that you're using an OLD version of the core GSAP file. ScrollSmoother requires 3.10.0 or later (I strongly recommend 3.10.4 or higher). I bet you've got something cached somewhere.  Maybe try deleting all your cached files, completely remove the gsap-trial and gsap package from your node_modules folder, and re-install? 

Link to comment
Share on other sites

Agh! Thanks so much. That indeed did the trick.

  • Like 1
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.