<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<style>
.box {
position: relative;
width: 800px;
height: 600px;
margin: 100px auto;
border: 2px solid crimson;
}
.box img {
position: absolute;
width: 760px;
height: 550px;
left: 50%;
margin-left: -360px;
}
.boxLeft,
.boxRight {
opacity: 0;
}
.box-moving .boxRight {
animation: animate3 0.5s linear infinite 0.25s;
}
.box-moving .boxLeft {
border: 1px solid;
animation: animate2 0.5s linear infinite;
}
@keyframes animate1 {
0% {}
100% {
opacity: 1;
}
}
@keyframes animate2 {
0% {}
50% {
opacity: 1;
}
100% {}
}
@keyframes animate3 {
0% {}
50% {
opacity: 1;
}
100% {}
}
</style>
<body>
<div class="box">
<img src="images/box.png" class="boxImg" alt="">
<img src="images/boxLeft.png" class="boxLeft" alt="">
<img src="images/boxRight.png" class="boxRight" alt="">
</div>
<button>开始</button>
<script>
document.querySelector('button').onclick = function() {
document.querySelector('.box').className += ' box-moving'
}
</script>
</body>
</html>
模拟抽奖
猜你喜欢
转载自blog.csdn.net/qq_35425276/article/details/80624691
今日推荐
周排行