Jump to content
Search Community

Invalid property ScrollTrigger

koalainside test
Moderator Tag

Recommended Posts

The error:

Invalid property ScrollTrigger set to

Object { trigger: ".c" }

Missing plugin? gsap.registerPlugin()

 

I have included both scripts:

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

and

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

 

Where is the error?

Thanks

See the Pen jOWMWoN by koalainside (@koalainside) on CodePen

Link to comment
Share on other sites

  • 9 months later...
  • 9 months later...

What does your ScrollTrigger code look like? You can verify that ScrollTrigger is loaded by logging it out. 

 

console.log("ScrollTrigger", ScrollTrigger)

 

If it shows something like this, then ScrollTrigger is loading fine and the problem is probably in your code somewhere.

 

image.png

 

Link to comment
Share on other sites

Phewks it works now...I went through my code keenly typing each line, getting the flow and hunt down the bug...thanks OSU Blake for the quick response..I appreciate it..and for the gsock creators and fraternity...big thanks it has made me improve my website's aesthetic features of animations.. it's easier and better..

  • Like 1
Link to comment
Share on other sites

  • 10 months later...
On 6/15/2020 at 8:47 PM, _Greg _ said:
On 2/1/2022 at 3:19 AM, Israel Noah said:

Phewks it works now...I went through my code keenly typing each line, getting the flow and hunt down the bug...thanks OSU Blake for the quick response..I appreciate it..and for the gsock creators and fraternity...big thanks it has made me improve my website's aesthetic features of animations.. it's easier and better..

I am facing the same issue. Can you tell me how did you solve it

 

Link to comment
Share on other sites

  • 11 months later...

Please help, I've got the same error but I cannot for the life of me find where my issue is.

 

This is my GSAP JavaScript:

import { gsap } from 'gsap'
import { ScrollTrigger } from 'gsap/ScrollTrigger'

export default {
  mounted() {
    let foreground = document.querySelector('.foreground')
    let header = document.querySelector('.header')
    let sidebar = document.querySelector('.sidebar')
    let content = document.querySelector('.content')

    gsap.registerPlugin(ScrollTrigger)

    gsap.set(header, { opacity: 0 })
    gsap.set(sidebar, { opacity: 0 })
    gsap.set(content, { opacity: 0 })

    const tlEE = gsap.timeline({
      scrollTrigger: {
        trigger: foreground,
        start: 'center',
        end: 'center-=10',
        scrub: true,
        markers: true
      }
    })

    tlEE
      .to(header, { opacity: 1, duration: 0.5 })
      .to(sidebar, { opacity: 1, duration: 0.5 })
      .to(content, { opacity: 1, duration: 0.5 })
   }
}

 

This is my HTML (Vue.3 and Tailwind CSS):

<template>
  <div class="main h-[100vh]">
    <div class="foreground overflow-hidden absolute">
      <Header class="header" />
      <div class="flex flex-row">
        <Sidebar class="sidebar" />
        <div class="w-[95vw] h-[85vh] grow z-20">
          <AboutMe class="content" />
        </div>
      </div>
    </div>
    <Background class="background absolute" />
  </div>
</template>

Any help will be massively appreciated > 👍

 

This is what I got when I ran "console.log('ScrollTrigger', ScrollTrigger)":

ScrollTrigger ƒ ScrollTrigger3(vars, animation) {
    _coreInitted2 || ScrollTrigger3.register(gsap2) || console.warn("Please gsap.registerPlugin(ScrollTrigger)");
    _context2(this);
    this.init(vars, animation)…

 

Link to comment
Share on other sites

It's pretty tough to troubleshoot without a minimal demo - the issue could be caused by CSS, markup, a third party library, your browser, an external script that's totally unrelated to GSAP, etc. Would you please provide a very simple CodePen or Stackblitz that demonstrates the issue? 

 

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.

 

Here's a starter CodePen that loads all the plugins. Just click "fork" at the bottom right and make your minimal demo

See the Pen aYYOdN by GreenSock (@GreenSock) on CodePen

 

Using a framework/library like React, Vue, Next, etc.? 

CodePen isn't always ideal for these tools, so here are some Stackblitz starter templates that you can fork and import the gsap-trial NPM package for using any of the bonus plugins: 

 

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

23 hours ago, GSAP Helper said:

It's pretty tough to troubleshoot without a minimal demo - the issue could be caused by CSS, markup, a third party library, your browser, an external script that's totally unrelated to GSAP, etc. Would you please provide a very simple CodePen or Stackblitz that demonstrates the issue? 

 

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.

 

Here's a starter CodePen that loads all the plugins. Just click "fork" at the bottom right and make your minimal demo

 

 

Using a framework/library like React, Vue, Next, etc.? 

CodePen isn't always ideal for these tools, so here are some Stackblitz starter templates that you can fork and import the gsap-trial NPM package for using any of the bonus plugins: 

 

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. 

I have tried re creating my issue within GSAP CodePen but I cant seem to get the error, I will give any info needed on my specific problem, it seems that it just doesnt want to work for me, I have the latest version of gsap also.

Link to comment
Share on other sites

Hi @Jordan.

 

We have a starter templates collection for Vue3 on Stackblitz:

https://stackblitz.com/@GreenSockLearning/collections/gsap-vue3-starters

 

Feel free to fork one of those in order to show the problem you're facing. Remember to keep your demo as small as possible, we don't have the time resources to traverse through a series of files trying to find the problem, just a few colored divs and the pertinent JS to show the problem.

 

Happy Tweening!

Link to comment
Share on other sites

Yeah, that error means that somewhere you're creating a tween/timeline with a ScrollTrigger but you haven't loaded/registered ScrollTrigger yet. Don't forget: 

gsap.registerPlugin(ScrollTrigger);

I see that you did that in your sample code, but you must have a component somewhere else that's not doing it properly. Just a guess - it's super difficult to troubleshoot without seeing the problem in context or being able to reproduce it. 

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