I'm trying to make expanding animation on pop-up div element.
I want to show the pop-up div with expanding animation when I just open main page.
But always pop-up div's height is 0. I tried so many ways, but nothing works.
Nowhere not below codes, controlling pop-up layer's height.
.popupLayer //I tried setting it's height not to 0, but same.
{
position:absolute;
width:76%;
left:50%;
top:0%;
transform: translate(-50%, -55%);
display:none;
background-color:white;
border-radius: 25px;
overflow: hidden;
}
.expand{
max-height:86%;
transition: max-height 2s ease-in;
}
I'm trying with following code:
window.onload = function(){
var expandDiv = document.getElementsByClassName('popupLayer')[0];
expandDiv.style.display='inline';
expandDiv.style.top = '55%';
$(expandDiv).addClass('expand');
};
<body>
... // some elements including popup div..
<div class = 'popupLayer'>
...// popuplayer body
</div>
...
</body>
I reffered following links. Expand div on click with smooth animation, How can I transition height: 0; to height: auto; using CSS? .
Thank you for your helps. :)