Jump to content
GreenSock

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.

 

 

<html>

<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
    tlLoader
        .staggerFromTo(loadContents, 0.3,
            {y:0, autoAlpha: 0},
            {y:20, autoAlpha: 1, ease:Back.easeInOut},
            0.05    
        )
        .fromTo(loader,0.3,
            {autoAlpha: 1, scale: 1.3},
            {autoAlpha: 0, scale: 1, ease:Power0.easeNone},
            0.9
        );

}
start();

 

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

Share this post


Link to post
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>
<!-- NOW ADD YOUR FILE -->
<script src="js/myScript.js"></script>

 

Happy Tweening!!!!

  • Like 4

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×