Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
JS animate to auto function
jQuery.fn.animateHeightAuto = function(speed, callback) {
var height;
return this.each(function(i, $element) {
var $this = $( $element );
var heightBackup = $this.css('height');
$this.css({
'height': 'auto'
});
height = $this.css('height');
$this.css({
'height': heightBackup,
});
$this.animate({
'height': height,
}, speed, callback);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.