Hello I want to transition div's height smoothly when I append an element to it, but I cannot get it to work I read this SO post smooth growing of div when appending children using transitions
but it does not answer the question correctly as it is fading in the element opposed to transitioning the div's height that the elements are in
setInterval(function() {
var li = document.createElement("li");
li.innerHTML = "item";
document.getElementById("list").appendChild(li);
}, 1000);
#menu #list {
max-height: 300px;
transition: max-height 0.15s ease-out;
background: #d5d5d5;
}
<div id="menu">
<ul id="list">
<!-- Create a bunch, or not a bunch, of li's to see the timing. -->
<li>item</li>
<li>item</li>
</ul>
</div>