I want this div to fold from top to bottom. How can I do this? I have tried to move the top up while increasing the height but it gives an immediate increase in height as a result.
var div = document.getElementById("div");
div.onmouseover = function(){
div.className = "expand";
}
div.onmouseout = function(){
div.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="div"></div>