0

Proper way to add CDN, I'm getting an error

I'm trying to add the CDN of Gsap into my project. I added a script at the botton inside of the <body> but there is an error with the first variable used. https://code.sololearn.com/W7jc0rLbK9cg/#html I was able to get font awsome to load, just not Gsap. I was able to upload the code to CodePen and my personal page, but having trouble here. Any ideas on what to check? Thanks for your time!

16th Jul 2020, 11:30 PM
Erick Gonzalez
Erick Gonzalez - avatar
2 Réponses
+ 1
Eric Your code is trying to call the TweenMax object before the Gsap library is loaded, you can use the event DOMContentLoaded as you have done in your other projects here on sololearn namely "Score Cunter Webpage".
16th Jul 2020, 11:56 PM
ODLNT
ODLNT - avatar
+ 1
Hmmm its quit simple add your javascript code inside window.onload = function(){ Your js code } And second thing add your js CDN in head instead of last of the body and I think there is not use of adding to head it's all right there also. but add your javascript code in window.onload .
17th Jul 2020, 12:09 AM
Ayush Kumar
Ayush Kumar - avatar