Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
billy nugz

Problem tweening child and parent div/elements

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

Hey there,

 

Im trying to set up a simple animation for a child and parent div set up like so;

 

 

<div id="content">
        <img src="logo.png" id="myLogoImg">
</div>

 

The content div has a background that I would like to autoAlpha up from 0 then bring my myLogoImg up after a 1 second delay. The problem Im having is that I can only ever seem to tween one or the other not both.

 

my tweens look like this

 

 

TweenLite.from(document.getElementById("myLogoImg"),  3, {delay:0,css:{autoAlpha:0}});
TweenLite.from(document.getElementById("content"),  3, {delay:3,css:{autoAlpha:0}});

 

Am I going about this in the wrong way? My thanks in advance.

Link to comment
Share on other sites

Hmmm looks like switching to alpha worked out.

 

TweenLite.from(content,  1, {delay:0,css:{alpha:0}});
TweenLite.from(document.getElementById("myLogoImg"),  1, {delay:1,css:{alpha:0}});

Link to comment
Share on other sites

Wait, are you saying that if you autoAlpha:0 myLogoImg, it changes the "visibility" property of "content" too? I'm a little confused. Which is the parent? You flip-flopped the order in your last two posts, so it's tough to tell. If you autoAlpha:0 the parent, it would of course also hide the child. Maybe it'd help if you posted a very simple HTML page that demonstrates the problem?

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