I'm looking for a way to make this div fold from top to bottom. How can I achieve this effect without the height increasing abruptly?
var box = document.getElementById("box");
box.onmouseover = function(){
box.className = "expand";
}
box.onmouseout = function(){
box.className = "";
}
div{
position:absolute;
top:50%;
left:50%;
height:50px;
width:100px;
background-color:#000000;
transition:height 0.3s;
}
div.expand{
position:absolute;
top:50%;
left:50%;
height:100px;
width:100px;
background-color:#000000;
transition:height 0.3s;
}
<div id="box"></div>