Jump to content
Search Community

GSAP target not found warning on console

Stefano Monteiro test
Moderator Tag

Go to solution Solved by OSUblake,

Recommended Posts

3 hours ago, OSUblake said:

I'm guessing the nullTargetWarn doesn't apply to ScrollTrigger, and is just for animations. But like Cassie said, the best thing to do would be to check for the target before running your code.

Yes, but I should be able to change that in the next release.

 

And again, those are only warnings and they don't alter functionality at all. End users would never see those messages - it's purely about developer convenience (it helps troubleshoot your code). 

Link to comment
Share on other sites

  • 4 months later...

For every trigger I created a new variable (let) and a different class for each block to be animated.

So, every single animation has it's own class and variable name. Shame that could be done with just one call as all the animations are the same.

let elementg = document.querySelector('.aso-pic-align')

if (elementg) {
    gsap.from(".aso-pic-align", {
        duration: .5,
        stagger: true,
        y: 50,
        opacity: 0,
        stagger: 0.2,
        ease: "linear.none",
        scrollTrigger: {
            trigger: ".aso-pic-align",
            toggleActions: "restart none none reverse",
            start: "top 95%",
            end: "bottom 95%"
        }
    });
}

 

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