Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
eco_bach

Why can't I tween a simple div

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

Why can't I tween a simple div?
 
In my javascript the following works so I KNOW I have a proper refrence to my div
infoDiv.style.visibility="hidden";
but this doesn't(no errors, just fails!!)
TweenLite.to(  infoDiv,1,{alpha:0});

The div has absolute positioning applied but obviously this is not the value I am changing.

I am also using TweenLite elsewhere in the same javascript file so I know I am referencing it properly.

 

Link to comment
Share on other sites

Hello,

 

here is working codepen example of your code above:

 

See the Pen folIH by jonathan (@jonathan) on CodePen

 

In order to animate CSS properties you will need to include the CSSPLUGIN;

 

http://api.greensock.com/js/com/greensock/plugins/CSSPlugin.html

 

 With the help of the CSSPlugin, GSAP can animate almost any css-related property of DOM elements including the obvious things like width, height, margin, padding, top, left, and more plus more interesting things like transforms (rotation, scaleX, scaleY, skewX, skewY, x, y, rotationX, and rotationY), colors, opacity, and lots more. Don't forget to load the CSSPlugin to enable these capabilities.

 

or you can use TweenMax which includes CSSPLUGIN and other goodies all in one.

 

does that help? :)

  • Like 1
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.
×