Site icon Puneet Sharma – Freelance Web Developer

Why scrollTrigger is not working?

Hey if you are using GSAP to do animation on a scroll, you will need to include scrollTrigger plugin’s script additionally after the GSAP’s script.

Here is the scrollTrigger script CDN .You can also check this link – https://greensock.com/docs/v3/Installation?checked=core,scrollTrigger#CDN

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

After you have included the script you will also need to register the plugin for use in your codes. Example:

gsap.registerPlugin(ScrollTrigger);

After you have registered you can use the plugin. Example:

gsap.to(".box", {
  scrollTrigger: ".box" ,
  x: 400,
  rotation:360,
  duration: 3
});
Exit mobile version