Well, I switched to using max-height, cleaned up my code, and now it looks like this:
Javascript:
Code:
PopulateVehicleFeatures(data);
PopulateOptionFeatures(data);
SetDefaultCheckboxtStates(data);
_totalPrice = CalculateTotalPrice(data);
CreatePlaceOrderAndPriceDiv(_totalPrice);
WireCheckboxesToEventHandler();
$("#VehicleFeaturesDiv").removeClass("VehicleFeaturesHide");
$("#VehicleFeaturesDiv").addClass("VehicleFeaturesShow");
CSS:
Code:
.VehicleFeaturesHide
{
display: none;
max-height: 0;
}
.VehicleFeaturesShow
{
display: flex;
flex-wrap: wrap;
padding: 10px;
margin: 15px 0;
border: 3px #00447c solid;
border-radius: 7px;
width: 600px;
-webkit-transition: max-height 5s ease-in;
-moz-transition: max-height 5s ease-in;
-ms-transition: max-height 5s ease-in;
-o-transition: max-height 5s ease-in;
transition: max-height 5s ease-in;
max-height: 1000px;
}
HTML:
Code:
<div id="VehicleFeaturesDiv" class="VehicleFeaturesHide"></div>
But it's still no go.
Note that I moved the
$("#VehicleFeaturesDiv").removeClass("VehicleFeaturesHide");
$("#VehicleFeaturesDiv").addClass("VehicleFeaturesShow");
to the end of the steps in the javascript. I'm thinking that if I leave the div hidden with max-height=0 as I'm adding content, and then add the class to animate it, it will be forced to increase its height because all the content is already there and it should animate. But this is still not happening.
I'm wondering if the way I'm adding the VehicleFeaturesShow class at run time is an issue. I know that I've had issues with .addClass() and .removeClass() before. All the examples of height animation I've googled use a hover effect which can be done in CSS (no adding or removing classes in javascript). Have you ever experienced issues similar to this with these?
Bookmarks