-
Save the current height:
var curHeight = $('#first').height();
-
Temporarily switch the height to auto:
$('#first').css('height', 'auto');
-
Get the auto height:
var autoHeight = $('#first').height();
-
Switch back to
curHeight
and animate toautoHeight
:$('#first').height(curHeight).animate({height: autoHeight}, 1000);
And together:
var el = $('#first'),
curHeight = el.height(),
autoHeight = el.css('height', 'auto').height();
el.height(curHeight).animate({height: autoHeight}, 1000);