Jump to content
Search Community

GSAP 3.10.3 not importing ScrollTrigger/ ScrollSmoother correctly?

synthwavenomad test
Moderator Tag

Go to solution Solved by synthwavenomad,

Recommended Posts

Hey fellow Gsappers,

I am having an issue since the latest update. I am a club greensock member so I should be able to access the ScrollSmoother plugin.

I am importing in gsap, ScrollTrigger & ScrollSmoother but I am getting an error in the console and I am not sure why. I'm using a gulp workflow to compile but this hadn't been an issue until now. If I drop ScrollSmoother and do a test tween using ScrollTrigger everything works - so the issue definitely relates to ScrollSmoother?

Assuming others may also be having this issue - any help is much appreciated. ✌️

error.jpg

html.jpg

js-code.jpg

Link to comment
Share on other sites

Welcome to the forums @synthwavenomad

 

I can't reproduce that issue. I'm wondering if maybe your setup doesn't allow ES modules. Have you tried importing the UMD modules from the dist folder?

 

import { gsap } from "gsap/dist/gsap";
import { ScrollTrigger } from "gsap/dist/ScrollTrigger";
import { ScrollSmoother } from "gsap/dist/ScrollSmoother";

 

Link to comment
Share on other sites

Hi @OSUblake thank you for your response!

Unfortunately that has not changed anything, as mentioned it does work find if I don't use ScrollSmoother. For instance I could run a basic ScrollTrigger Timeline no issue but it is erroring because of importing in ScrollSmoother. I just keep getting the below error. Other plugins are working fine. 

image.png.6db79d36ebfe64b18fc6933749c12684.png

Link to comment
Share on other sites

  • 4 months later...
  • 1 year later...
On 4/12/2022 at 6:16 PM, synthwavenomad said:

@OSUblake I have now solved this issue. Basically I was being a dumb dumb. I just noticed that my script was loading in the </head> instead of before </body>. I just didn't catch it sooner as my other code ran.

@mariselvam this was the solution, it was to do with how I was enqueueing the JavaScript in my WordPress setup. Are you using WordPress? If you provide me more information about your setup & issue I will try and help you debug and resolve the issue. 🙂

Link to comment
Share on other sites

@mariselvam, it's almost impossible to troubleshoot without a minimal demo. Would you please provide a very simple Stackblitz that demonstrates the issue? Here's a Stackblitz starter template you can fork: 

https://stackblitz.com/edit/nextjs-5cm4qn

 

Please don't include your whole project. Just some colored <div> elements and the GSAP code is best. See if you can recreate the issue with as few dependancies as possible. If not, incrementally add code bit by bit until it breaks. Usually people solve their own issues during this process! If not, then at least we have a reduced test case which greatly increases your chances of getting a relevant answer.

 

Please share the StackBlitz link directly to the file in question (where you've put the GSAP code) so we don't need to hunt through all the files. 

 

Once we see an isolated demo, we'll do our best to jump in and help with your GSAP-specific questions. 

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...