I'm trying to animate the height property of an element and for some reason it isn't animating at all.
Here's the fiddle where I'm trying to animate.
HTML
<ul>
<li>
li 1
</li>
<li>
li 2
</li>
<li>
li 3
</li>
</ul>
Css
ul.hide {
height: 0px;
overflow: hidden;
}
ul {
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out;
-o-transition: all 1s ease-in-out;
-ms-transition: all 1s ease-in-out;
transition: all 1s ease-in-out;
}
JS:
setTimeout(function () { $('ul').addClass('hide'); }, 2000);
setTimeout(function () { $('ul').removeClass('hide'); }, 4000);
Is there something I'm missing or forgetting about?