I am trying to get a modal animating with Tweenmax. It currently animates but the issue I am having is that I want it to animate from the top of the screen to the middle and stop there. Currently, it just animates into the middle.
HTML:
<button onclick="clickButton();">Testing</button>
<div id="container">
<div class="background">
<div class="modal">
<h2>Testing Modal</h2>
<p>Testing.</p>
</div>
</div>
</div>
JS:
clickButton = function() {
TweenMax.to("#container", 0.3, {
className: "+=active",
ease: Power1.easeOut
});
};
I have tried using CSS to do this:
#modal-container .modal-background {
display: table-cell;
background: rgba(0, 0, 0, 0.8);
text-align: center;
vertical-align: top;
}
#modal-container.active .modal-background {
vertical-align: center;
}
Change your transform
like this
#container.active {
transform: translateY(100%);
}
And your #container
position top
and left
#container {
position: fixed;
display: table;
height: 100%;
width: 100%;
top: -100%;
left: 0;
z-index: 1;
}
Its may help you, here's my code for your issue Codepen