首页 > 代码库 > 水波纹--转载
水波纹--转载
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
@keyframes turn{
from{transform: rotate(0deg);}
to{transform: rotate(360deg)}
}
.wave{
width:150px;
height: 150px;
border: 5px solid #000;
border-radius: 50%;
position: absolute;
top:100px;
left: 100px;
overflow: hidden;
z-index: 1;
line-height: 150px;
background: rgba(0,0,0,.6);
}
.turn{
width: 350px;
height: 350px;
position: absolute;
background: rgba(200,100,30,1);
border-radius:40%;
top:100%;
left:-100px;
animation: turn 5s linear infinite;
}
.tips{
width: 150px;
position: absolute;
font-size: 30px;
color: #fff;
text-align: center;
}
</style>
</head>
<body>
<div class="wave">
<div class="turn"></div>
<div class="tips">1%</div>
</div>
</body>
<script type="text/javascript" src="http://www.mamicode.com/jquery-1.11.1.js"></script>
<script type="text/javascript">
var topNum = 100;
var timer = setInterval(function(){
$(".turn").css({"top":topNum+"%"});
topNum -= 0.005;
var text = parseInt(100 - topNum)+"%";
$(".tips").text(text);
if(topNum <= 0){
clearInterval(timer);
}
},1);
</script>
</html>
水波纹--转载