Jump to content
Search Community

Animate top property with percentage

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

if you want to use top:50% on an element

 

1) make sure that its position is absolute

See the Pen 74c0c95913c6bd93ca487a81cbc37a68 by GreenSock (@GreenSock) on CodePen

 

or

 

2) make sure its position is relative AND its parent element has a height specified

See the Pen a62450d29d8c693be964152baf3ac14f by GreenSock (@GreenSock) on CodePen

 

I'm pretty sure that's just the way it has to be with css.

 

Notice in each example #box2 simply has top:50% set and it matches exactly with the tweened element.

 

 

 

If you still have problems, please provide an example. Its hard to guess what might be going on without any details. Perhaps there is something we are missing.

  • 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.
×
×
  • Create New...