I have a simple scrolltrigger animation:
import { gsap } from "gsap";
import ScrollTrigger from "gsap/ScrollTrigger";
gsap.registerPlugin(ScrollTrigger);
document.addEventListener("astro:page-load", () => {
gsap.fromTo(
".fadeup-st",
{
opacity: 0,
y: 25,
},
{
opacity: 1,
y: 0,
duration: 0.5,
ease: "cubic-bezier(0,0,0.5,1)",
scrollTrigger: {
trigger: ".fadeup-st",
start: "top 80%",
end: "bottom 20%",
toggleActions: "play none none reverse",
markers: true,
},
}
);
It's only detecting the first element that appears on the screen. In console I get GSAP target not found but have intialized all gsap pkgs. Not sure what the problem is! Thank you.