Confirmation popup animation
by Shuaib Khan
HTML
<script src="//www.addressfinder.co.nz/assets/v2/widget.js"></script>
<div class="container">
<div class="pop-cont">
<h4 class="heading">
Are you sure you want to delete this Item
</h4>
</div>
<a class="main-btn">
Delete
</a>
</div>
CSS
body {
padding: 5px;
}
.container{
width:100%;
height:400px;
position:relative;
}
.main-btn{
width: 250px;
max-height: 40px;
border:none;
padding: 10px 15px;
text-align: center;
background-color: #4374e0;
position:absolute;
top:0;
bottom:-120px;
left:0;
right:0;
margin: auto;
color:#fff;
font-size:32px;
border-radius: 8px;
cursor:pointer;
font-family: 'Roboto'
}
.main-btn:hover, .main-btn:active, .main-btn:visited{
background-color: #1f4fb9;
outline: 0;
}
.pop-cont{
position:absolute;
padding: 40px 15px;
box-sizing: content-box;
font-family: 'roboto';
font-weight: 100;
width: 250px;
height: 40px;
border: 1px solid #f1f1f1;
box-shadow: 0 0 15px #eee;
top:0;
left:0;
bottom:-120px;
right: 0;
margin: auto;
border-radius: 10px;
transition: all ease-in 0.3s;
background-color: #f9f9f9
}
.heading{
font-size: 32px;
text-align:center;
}
.pop-cont.open{
/* width: 450px;
height: 300px;
bottom: 0; */
animation-name: bounce;
animation-duration: 0.5s;
animation-iteration-count: 1;
animation-fill-mode: forwards;
animation-timing-function: ease-out;
}
@keyframes bounce {
0% { width: 250px; height: 40px; bottom:-120px }
10% { width: 280px; height: 100px; bottom: -100px }
30% { width: 350px; height: 150px; bottom: -80px }
50% { width: 450px; height: 300px; bottom: -60px }
60% { width: 480px; height: 320px; bottom: -40px }
70% { width: 520px; height: 350px; bottom: -20px }
80% { width: 480px; height: 320px; bottom: 0px }
85% { width: 450px; height: 300px; bottom: 20px }
90% { width: 420px; height: 250px; bottom: 40px }
95% { width: 440px; height: 280px; bottom: 20px }
100% { width: 450px; height: 300px; bottom: 0px; }
}
JavaScript
$(document).ready(function() {
$(".main-btn").on("click", function(e){
$(".pop-cont").addClass("open")
})
});