Jump to content
GreenSock

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

Expand div from bottom to top?

Go to solution Solved by Shaun Gorneau,

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,

 

My first post here, I guess it's a real newbie one... I searched and couldn't find any post with this question, so I hope it's ok. What I try to do is to have a div expand from the bottom up, but I can only get it to expand from top to bottom. How can I reverse this?

 

//Devotee007

 

CSS:

.wrapper {
position:absolute;
top:40px;
left:40px;
width:430px;
height:0px;
z-index:1;
background-color:#000;
overflow:hidden; 
}
 
 
TweenMax.to(".wrapper", 1.2, {height:"430px", ease:Expo.easeOut});

 

Link to comment
Share on other sites

  • Solution

Use a child element within the wrapper, absolutely positioned and bottom: 0;

 

Then tween the height of the child;

 

See the Pen EjBzwB by sgorneau (@sgorneau) on CodePen

  • Like 4
Link to comment
Share on other sites

It sounds like you might want to animate a rectangular clipping path.  I had actually been wondering how to do the same thing recently, and found a helpful example in another thread.

 

I forked & updated it: 

See the Pen OVeeQa by ohem (@ohem) on CodePen

 

Masking/clipping custom shapes across browsers is kind of a nightmare, but clipping rectangles is well supported.  https://msdn.microsoft.com/en-us/library/ms530748(v=vs.85).aspx

 

Apparently clip rect is deprecated though...(?)

https://developer.mozilla.org/en-US/docs/Web/CSS/clip

 

But clip path seems to work too: 

See the Pen rVEEKL by ohem (@ohem) on CodePen

 

Any experts feel free to weigh in or correct me if there's anything wrong with my examples, I'm still new at this too.   :)

Link to comment
Share on other sites

@Shaun: 

 

Thanks a lot for the fast help, it works great! :)

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