Jump to content
Search Community

ScrollTrigger Plugin not working

Novaliz test
Moderator Tag

Go to solution Solved by Novaliz,

Recommended Posts

I am using gsap with a vanilla Vite environment with Sass and npm install. The core plugin and the text plugin did work but not the ScrollTrigger plugin. What could be the problem? I am getting this error in the console:

 

"gsap.js?v=3fc78497:84 Invalid property ScrollTrigger set to .star Missing plugin? gsap.registerPlugin()"

 

I googled my problem but all the solutions I have found did not work for me.

 

main.js file:

import { gsap } from "gsap";
import { ScrollTrigger } from "gsap/ScrollTrigger";
 
gsap.registerPlugin(ScrollTrigger);
 
gsap.from(".star", {
duration: 3,
rotation: -360,
ScrollTrigger: ".star",
});

 

html file:

<!-- Hero -->
<section class="hero"></section>
<!-- Section-1 -->
<section class="section-1"></section>
<!-- Section-2 -->
<section class="section-2">
<img class="star" src="/assets/img/star.svg" alt="" />
</section>
 
<!-- Section-3 -->
<section class="section-3"></section>
<!-- Javascripts -->
<script type="module" src="/main.js"></script>
</body>
</html>

 

 

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