I am using nganimate
and have an animation in place on the max-height property of a div like so:
css
.sublist.ng-hide {
max-height: 0;
}
.sublist {
max-height: 1300px;
overflow: hidden;
-webkit-transition: 0.75s cubic-bezier(0.35, 0, 0.25, 1) all;
-moz-transition: 0.75s cubic-bezier(0.35, 0, 0.25, 1) all;
transition: 0.75s cubic-bezier(0.35, 0, 0.25, 1) all;
}
html
<button ng-click="toggle=!toggle">{{toggle ? 'Hide' : 'Show'}} Items</button>
<div style="background-color:#fff; border: 1px black solid;" ng-show="toggle" class="sublist">
<ul>
<li ng-repeat="name in names">
<a href="#"> {{name}} </a>
</li>
</ul>
</div>
I would like to know if there's any way for the height\max-height to be set based on the height of the child items inside the div I'm animating on using css alone?
Also, I notice there's a delay when clicking the button in the demo before the div hides. Is it possible to get the div to collapse as soon as the button is clicked?