Jump to content
Search Community

Placing <script> in html code

ahsartag test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi. I'm a newbie in coding.
A few days ago I installed Webstorm and my GSAP code was not working. Tech support on forum didn't help me, although I sent them the folder with css html and js.
Only today I realized after examining zip folder of my project from CodePen that <script> tags were placed there in the end of html.
And after correction of this my new project started to work.

Should I always move all of my <script> in the end?

Link to comment
Share on other sites

Hi ahsartag :)

 

You usually want to place your scripts at the bottom of the page so they won't slow down any content from loading. The exception would be a script that may be immediately necessary for some part of the user interface. Another thing to remember is the scripts are loaded from the top down so if you have some script that depended on jQuery being loaded, you'd want to make sure jQuery is loaded before that script.

 

Rather than load your own scripts, I'd highly recommend using a CDN for your GSAP (and other) scripts so you'll realize the benefit of caching. 

 

Hopefully that helps.

 

Happy tweening.

:)

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