Home >Web Front-end >CSS Tutorial >How to Animate a Div Element to Auto Height Using jQuery?
When attempting to animate a
var curHeight = $('#first').height();
$('#first').css('height', 'auto');
var autoHeight = $('#first').height();
$('#first').height(curHeight).animate({height: autoHeight}, 1000);
var el = $('#first'), curHeight = el.height(), autoHeight = el.css('height', 'auto').height(); el.height(curHeight).animate({height: autoHeight}, 1000);
The above is the detailed content of How to Animate a Div Element to Auto Height Using jQuery?. For more information, please follow other related articles on the PHP Chinese website!