Jump to content
Search Community

GSAP not triggered

mmmmm0ffffffff test
Moderator Tag

Recommended Posts

Hello,


Not the expert one here, but I'm trying something simple.

The Codepen works, but won't work on my website - attaching also the console log.

 

Not sure really where I'm mistaking as it works on Codepen, must be something basic but not sure where/what to look for?!

 

Any leads? Would make my day!

Thanks!

 

 

Screen Shot 2020-09-05 at 15.27.04.png

See the Pen BaKJyrN by mmmmm0fffffffff (@mmmmm0fffffffff) on CodePen

Link to comment
Share on other sites

Hey mmmmm0ffffffff and welcome to the GreenSock forums.

 

Those console messages tell us that there is no element with a class of massiveImage on your page by the time that the script runs. So either make sure to add it to your page or make sure the JS runs after that element is loaded.

 

Perhaps another issue is because you're loading the CodePen versions of the GSAP files instead of the CDN versions (like you should be using)? Try these files instead:

https://cdnjs.cloudflare.com/ajax/libs/gsap/3.5.1/gsap.min.js
https://cdnjs.cloudflare.com/ajax/libs/gsap/3.5.1/ScrollTrigger.min.js

  • Thanks 1
Link to comment
Share on other sites

22 minutes ago, ZachSaucier said:

Hey mmmmm0ffffffff and welcome to the GreenSock forums.

 

Those console messages tell us that there is no element with a class of massiveImage on your page by the time that the script runs. So either make sure to add it to your page or make sure the JS runs after that element is loaded.

 

Perhaps another issue is because you're loading the CodePen versions of the GSAP files instead of the CDN versions (like you should be using)? Try these files instead:

https://cdnjs.cloudflare.com/ajax/libs/gsap/3.5.1/gsap.min.js
https://cdnjs.cloudflare.com/ajax/libs/gsap/3.5.1/ScrollTrigger.min.js

 

Hey Zach, this was fast and correct - the JS was running too soon!

 

Thanks a lot, very very helpful, I basically finished my website now!

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