Skip to content

Instantly share code, notes, and snippets.

@timhettler
Created March 12, 2012 16:24
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save timhettler/2023150 to your computer and use it in GitHub Desktop.
Save timhettler/2023150 to your computer and use it in GitHub Desktop.
Animating an element from a fixed height to "auto" height using jQuery
var $selector = $('div');
$selector.data('oHeight',$selector.height()).css('height','auto').data('nHeight',$selector.height()).height($selector.data('oHeight')).animate({height: $selector.data('nHeight')},400);
@leonmarkus
Copy link

Works like a charm!
I was looking for something like that for hours.. until I find this. Amazing job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment