Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Riyas Ahamed

Remove GSAP error from Console Log

Recommended Posts

I have some animation on my home page when i check homepage console log that was clear if i move other pages GSAP say's missing these element how to remove that erros. Please see the attachments

 

machine (2).png

Link to post
Share on other sites

hi again Riyas

these error messages indicate that the specified selectors cannot be found by gsap so therefore cannot be processed.

eg if you are using the code suggested by zach earlier in your javascript then the html should have a corresponding element.

That is a reference to ".top" in your tween or trigger requires a class="top" somewhere in your html that can be resolved at runtime.


 
  • Like 1
  • Thanks 1
Link to post
Share on other sites

Yes .top class only on HOME page. These error came from about us page ABout us page doesn't have .top element GSAP code in script.js that file will include all pages so how can i remove these error from about us page?

NOTE: I Need Animation only HOME Page  

Link to post
Share on other sites

i use a different script for each html page. 

alternatively don't include your home.js script in about.js if you get my drift.

  • Like 3
  • Thanks 1
Link to post
Share on other sites

Yes but i also want to reduce Request so i'm not able to do separate file i need other alternative solution 

Link to post
Share on other sites

To be clear, they're warnings, not errors. To get rid of the warnings just make sure that the target exists before creating any tweens that use it.

 

But there's really not much reason to worry about loading from one script vs multiple. That was more important years ago but these days there's little to no difference AFAIK.

  • Thanks 1
Link to post
Share on other sites

Also, FYI, if you want to stop GSAP from warning you about those null targets, you can do this: 

gsap.config({ nullTargetWarn: false });

 

  • Like 3
  • Thanks 1
Link to post
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.

×