Jump to content
Search Community

Nothing happens using TweenLite

Madster 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

Hi guys,

 

I have an animation in Jquery, which I want to "recreate" in GSAP.

 

Jquery:

$(document).ready(function(){
   $('#newsContainer').animate({
  height: '+=400'
   }, 2000, function() {
  // Animation complete.
   });
});

 

 

GSAP:

$(document).ready(function(){
   var newsContainer = document.getElementById("newsContainer");
   TweenLite.to( newsContainer, 2, {css:{height:"800px"}});
});

 

The animation works perfect in Jquery, but nothing happens using GSAP - no errors, no nothing.

 

Any suggestions?

Link to comment
Share on other sites

A few questions:

  1. Did you load TweenLite or TweenMax?
  2. Does the "newsContainer" start at 400px in height? It looks like you're doing a relative tween in jQuery, but an absolute on in TweenLite - why? You can do "+=400" in TweenLite too.
  3. Can you please post a very simple HTML page that demonstrates the issue so that we can see it in context for ourselves? I wonder if there's something else going on in your JS or HTML that's causing the issue.

Link to comment
Share on other sites

Oh! You forgot to load the CSSPlugin :) Remember, TweenLite isn't just for tweening DOM elements - it can tween any JavaScript object. The CSSPlugin needs to be loaded in order for TweenLite to tween css properties of DOM elements. Have you checked out the "getting started" guide at http://www.greensock.com/get-started-js/? That has instructions about loading CSSPlugin and what it can do.

Link to comment
Share on other sites

Doh!

 

It probably happened because I initially was trying to change the height without the css.

Would be nice if it threw an error like "CSS plugin missing" or something instead of just failing silently though.

 

Thanks a lot for the help :-)

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