<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<style>
* {
margin: 0;
padding: 0;
}
.beginAnimateCls {
width: 100px;
height: 20px;
background-color: #2AC845;
color: #FFFFFF;
line-height: 20px;
text-align: center;
margin: 20px auto;
cursor: pointer;
}
@keyframes upward {
0% {bottom: -500px;opacity: 0;}
100% {bottom: 0;opacity: 1;}
}
.poin-up {animation: upward 0.2s linear;}
.shadeMisk {
width: 100%;
height: 100%;
position: absolute;
bottom: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.5);
display: none;
}
</style>
</head>
<body>
<div class="beginAnimateCls" id="btn1">开启动画</div>
<div class="shadeMisk" id="shadeMiskID"></div>
</body>
</html>
<script>
document.getElementById('btn1').onclick = function(){
document.getElementById('shadeMiskID').style.display = 'block';
document.getElementById('shadeMiskID').classList.add('poin-up');
}
</script>