Jump to content
Search Community

Gsap Runs 1/4 of the times

sylvain1870 test
Moderator Tag

Recommended Posts

Hello guys,

 

It seems i can't fin any solution yet but my Gsap runs 1/4 of the time.

I tried using with CDN and Zip but both return the same error 1/4 of the time if reload the page. 

CodeJS.js:1 Uncaught ReferenceError: gsap is not defined

 

Right now i am trying with the files.js , i ve put the <script>  in the <head> with async and defer.

I also have

gsap.registerPlugin(ScrollTrigger);

in first of my js code.

Can anyone help me please? i'm willing to learn Gsap but there it bringing me crasy as i cannot even get stared :(

 

Thank you so much in advance.

Link to comment
Share on other sites

You should always put your files before the closing </body> tag. When you put your files in the head, the DOM won't be ready, and you don't need async or defer.

 

<html>
  <body>
    <h1>Hello</h1>    
    <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.8.0/gsap.min.js"></script>
    <script src="myFiles.js"></script>
  </body>
</html>

 

  • Like 1
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...