Jump to content
Search Community

Uncaught Cannot tween a null target

simplesolution 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

I'm testing green sock in WordPress. ( beginner)

 

error : Uncaught Cannot tween a null target  

 

 

-----------------------------------------------------------------

 

// curve moving bezier 
TweenMax.to(document.getElementById("box1"), 6, {
  type:"soft",
    bezier:[
        {left:100, top:250},
        {left:600, top:0},
        {left:300, top:100}
    ], ease:Power1.easeInOut, repeat: -1, yoyo: true
});


---------------------------------------------------------------------

-> this code makes above error.

I didn't find the solution yet.

 

 

 

Link to comment
Share on other sites

There's a lot to look at here and it's difficult to troubleshoot a live site. I do see that TweenMax is not loading until you've loaded your main.js and ScrollMagic scripts. I'm wondering if changing that load order would fix this for you.

 

If you could create a super simple demo that demonstrates the problem, we'd have a better chance of pointing you in the right direction. More info:

Happy tweening.

  • Like 2
Link to comment
Share on other sites

I found the problem.

As your advice, I removed all code and made simple.

and then, I checked one by one.

 

If I removed below code, Everything is ok.

 

// curve moving bezier 
jQuery(document).ready(function(){
TweenMax.to(document.getElementById("box1"), 6, {
  type:"soft",
    bezier:[
        {left:100, top:250},
        {left:600, top:0},
        {left:300, top:100}
    ], ease:Power1.easeInOut, repeat: -1, yoyo: true
});
});

 

This code is fine in home. It works well.

but In the other page,

If I removed html markup(for above code), It made some error.

 

See the Pen xxKJawJ by mogwai90 (@mogwai90) on CodePen

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...