Here's how to do it:
- Get the height of the div to display (while it is still hidden).
- Set the height of the div to display at the height of the current displayed div.
- Hide the currently displayed div.
- Show new div.
- Animate the height of the new div with what it should be (which was done in the first step).
, div, :
$div.css({ position: 'absolute', visibility: 'hidden', display: 'block' });
var height = $div.height();
$div.css({ position: 'static', visibility: 'visible', display: 'none' });
jsfiddle
, html css:
(1) div 'form-show-item-3', div. .
(2) . <p> div div, - .
div.dinamic-form-content {
padding: 1px;
}