Jump to content

Search In
  • More options...
Find results that contain...
Find results in...
Cole Kim

Gsap CDN is not working....

Recommended Posts

I put the following CDN code in my HTML file and then executed TimelineLite function in javascript.




<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.1.2/TweenLite.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.1.2/TimelineMax.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.1.2/easing/EasePack.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.1.2/plugins/CSSPlugin.min.js"></script>


<My javascript code>

start = ()=> {

    let loader = document.getElementById('loading'),
    loadContents = document.getElementsByClassName('loading_content'),
    tlLoader = new TimelineMax();
    // Loader Timeline
        .staggerFromTo(loadContents, 0.3,
            {y:0, autoAlpha: 0},
            {y:20, autoAlpha: 1, ease:Back.easeInOut},
            {autoAlpha: 1, scale: 1.3},
            {autoAlpha: 0, scale: 1, ease:Power0.easeNone},



Then... the following error appeared in Console.


스크린샷 2019-04-27 오후 5.02.16.png


Why is this happening?


I guess I add the CDN code incorrectly, so I change to another CDN


<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.1.2/TweenMax.min.js"></script>


and tried to use changed TimelineMax to TimelineLite in my javascript code.


but this problem is still happening now.


plz.. help me

Link to comment
Share on other sites

Hi and welcome to the GreenSock forums.


The CDN links are working for me. Perhaps the issue is the order the tags are placed. Remember to put the tag with the href to your code after the tags with the CDN links.


If your code is in a file called myScript.js, then you should add the tag for that after the GSAP files and for that matter after every other library or framework you use in your site:


<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.1.2/TweenMax.min.js"></script>
<script src="https://code.jquery.com/jquery-3.4.0.min.js"></script>
<script src="js/myScript.js"></script>


Happy Tweening!!!!

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