Jump to content
Search Community

Jquery and GSAP are not interacting the way expected

paul_here test
Moderator Tag

Go to solution Solved by Rodrigo,

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

Hello, 

 

I am re-writing some basic code I was working on and adding GSAP. (TweenMax) I used the TweenMax object (function? I'm new at this.) and then attempted to use jquery's .queue to set up a JQuery function on completion. It doesn't work, but I don't know why, and I don't know what my alternatives are. 

 

Thank you for your time!

See the Pen JYdBbe by anon (@anon) on CodePen

Link to comment
Share on other sites

  • Solution

Hi and welcome to the GreenSock forums.

 

Turns out that basically you're trying to mix oil and water, no matter how hard you try it won't work :)

 

The method you're using is exclusive of jQuery and therefore it'll throw an error:

 

Uncaught TypeError: TweenMax.to(...).queue is not a function

 

Basically that says that .queue() is not a method of the TweenMax class. Keep in mind that most GSAP methods will return the instance itself, which makes chainability a real breeze, just like in jQuery (something that you're used to it seems;) ).

 

Finally Diaco's advice is spot on, as usual, since GSAP has a ton of callbacks and when you work with Timelines you can even add the call() method to the mix. Also GSAP offers that ability to pass parameters to the callbacks and set the scope in the callbacks. Just take a good look at that link and you'll be on your way.

 

If you have more questions, we're here to help.

 

Happy Tweening!!

  • Like 5
Link to comment
Share on other sites

  • 2 weeks later...

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