Jump to content
Search Community

Invalid property scrollTrigger ... Missing plugin? gsap.registerPlugin()

PaulGodard test
Moderator Tag

Recommended Posts

Hi.  I am totally new to GS. I am watching the ihatetomatoes GS101 – 01 – ScrollTrigger Basics and I get the following error writing the exact same code as in the video.

gsap.registerPlugin(ScrollTrigger);


function init(){
    gsap.to('#intro img', { opacity: 0, scrollTrigger: { trigger: '#intro', start: 'top top', scrub: true, markers: true } })
}

window.addEventListener('load', function(){
    init();
});

after loading the js in the html file

  <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.2.4/gsap.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/ScrollTrigger/1.0.5/ScrollTrigger.min.js"></script>
  <script src="js/main.js" defer></script>

Invalid property scrollTrigger set to

Object { trigger: "#intro", start: "top top", scrub: true, markers: true }

Missing plugin? gsap.registerPlugin()

 

I google the error but can not find what is the problem... most probably a stupid little thing...

Any idea?

 

update... I found that the version of gsap and scrolltrigger could be incompatrible so I change the html file but now nothing is changing when scrolling.

<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.6.0/gsap.js">
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.6.0/ScrollTrigger.js"> 

 

Edited by PaulGodard
update
Link to comment
Share on other sites

Welcome to forums, @PaulGodard

 

26 minutes ago, PaulGodard said:

most probably a stupid little thing...

 

It happens. Looks like you aren't loading the correct file. That's not GSAP's ScrollTrigger file, just another library that has the same name.

https://terwanerik.github.io/ScrollTrigger/

 

You can load the correct files from here.

https://cdnjs.com/libraries/gsap

  • Like 3
Link to comment
Share on other sites

Thank you again.  That is what I changed as indicated in the update of my original post.  So the html file looks like this but it's still does not work.

  <script src='https://cdnjs.cloudflare.com/ajax/libs/gsap/3.6.1/gsap.min.js'></script>
  <script src='https://cdnjs.cloudflare.com/ajax/libs/gsap/3.6.1/ScrollTrigger.min.js'></script>
  <script src = "js/main.js" defer></script>

Looking at the demos, I used the following links and it works.

  <script src='https://unpkg.co/gsap@3/dist/gsap.min.js'></script>
  <script src='https://unpkg.com/gsap@3/dist/ScrollTrigger.min.js'></script>
  <script src = "js/main.js" defer></script>

Weird isnt'it?

Link to comment
Share on other sites

8 minutes ago, PaulGodard said:

That is what I changed as indicated in the update of my original post.

 

Oh, we don't get notifications if you update your post, so I didn't see that. It's best to just create a new one.

 

I'm not sure why the cdjs links weren't working for you. I just tested them out, and they seem to be working fine here. 🤷‍♂️

 

See the Pen c02b09d41cadd4f8378487ff1d803f7b by osublake (@osublake) on CodePen

 

 

  • 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.
×
×
  • Create New...