Jump to content
Search Community

Problems tweening height to auto

jjvera 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

Hello friends!

I have a problem with tweening a div from height: 40px to height: auto (to expand the height to its content)

 

In the codepen you will see. The problem is at line 7 in the .js, if i change the height: '100%' to a fix value ex. 400px the transition happen smoothly but if a use a not-fixed value it "jumps" to the shape.
How can i solve this? i need the modal to animate depending on the content without much complexity.

 

Have a nice weekend!

.to('.tnd-modal-container', '.35', {width:"100%", height:"100%", borderRadius:"7px"},'modalCloseSurveyTime+=0.5')

CHANGE IT FOR

.to('.tnd-modal-container', '.35', {width:"100%", height:"400px", borderRadius:"7px"},'modalCloseSurveyTime+=0.5')

AND YOU WOULD SEE IT AS I WANT IT TO BEHAVE

 

See the Pen QBYygz by JulianVera (@JulianVera) on CodePen

Link to comment
Share on other sites

Hi Point! 

 

Thank you very much, this resolved the problem the only detail (correct me if is only me) i saw a flickr, like a repositioning of the div when you reverse the timeline one time and another? 

I-m going to read the topic and see what i can find

Link to comment
Share on other sites

If you want to watch it in slow motion and watch for the weird flicker you can set a slow timeScale. 

var modalCloseSurveyTl = new TimelineMax({ paused: true }).timeScale(0.1);

 

You could also use GSDevTools to scrub the timeline and watch for anything odd.

 

Edit: looks like we posted at the same time. Glad to hear you fixed it. :)

 

  • Like 5
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...