2 Attachment(s)
trying to animate height increase
Hello,
I'm trying to animate a div growing in height with CSS transitions. It's not working.
Here's what I've got:
At first, you have a textbox and a drop down list with an invisible div of height 0 underneath (see the attached screen screen shot: before.jpg).
Attachment 5789
Here's the html and the css:
<div id="VehicleFeaturesDiv" class="VehicleFeaturesHide"></div>
.VehicleFeaturesHide
{
display: none;
height: 0;
}
Then when the user selects an item from the list, some javascript runs and swaps out the VehicleFeaturesHide for VehicleFeaturesShow (see the attached screen shot: after.jpg):
Attachment 5790
The css looks like this:
.VehicleFeaturesShow
{
display: flex;
flex-wrap: wrap;
padding: 10px;
margin: 15px 0;
border: 3px #00447c solid;
border-radius: 7px;
width: 600px;
-webkit-transition: height 5s;
-moz-transition: height 5s;
-ms-transition: height 5s;
-o-transition: height 5s;
transition: height 5s;
}
The javascript then populates the div with a whole bunch of content, causing the height to increase with each content item:
$("#VehicleFeaturesDiv").removeClass("VehicleFeaturesHide");
$("#VehicleFeaturesDiv").addClass("VehicleFeaturesShow");
PopulateVehicleFeatures(data);
PopulateOptionFeatures(data);
SetDefaulCheckboxtStates(data);
_totalPrice = CalculateTotalPrice(data);
CreatePlaceOrderAndPriceDiv(_totalPrice);
WireCheckboxesToEventHandler();
The idea I have--and I'm probably wrong here--is that if I swap the hidden class for the show class, and the add content to the div (like I'm doing in the javascript) that will increase the height, and since we have height transition CSS in the show class, that increase in height should animate. No?
In any case, it's not working. Please help.