Jump to content
Search Community

Animate to height auto

JJulien test
Moderator Tag

Recommended Posts

Welcome to the forums @JJulien

 

It seems to work quite alright if you insert "auto" for the height-property to tween to.

 

I would probably stick with the .to() route here, as .from() will tween .from() the values you feed the tween with [ to the values you initially set there via CSS ] and for one you would probably have to use .to()-tweens anyway at some point and working with.from() tweens can become a bit puzzling in a scenario as such (well, at least for me it does).

 

Some other notes:

  • I would wrap the whole thing up in a load-event function to make sure your images are actually loaded when you set things up and the height of the images can be respected correctly.
  • I also changed the height in the CSS on your #expanded-menu to 0 instead of 0% - because those 0% actually didn't do anything

Hope that'll help a bit.

 

See the Pen 5bdefaf964844e6a7bd3ba12d6d2ac95 by akapowl (@akapowl) on CodePen

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