码迷,mamicode.com
首页 > Web开发 > 详细

JS实现转动效果

时间:2016-06-23 12:36:54      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:

方案一

<div class="div_uploading">
<div class="div_uploading_scroll"></div>
<div class="div_uploading_content"></div>
</div>

 

CSS样式

.div_uploading
{
width:150px;
height:150px;
z-index:10001;
position:absolute;
top:40%;
left:40%;
}

.div_uploading_scroll
{
width:185px;
height:185px;
background:url(../../image/book/uploading1.png);
position: absolute;
border-radius: 185px;
left: 0;
top: 0;
animation:scroll 2s infinite linear;
}

.div_uploading_content
{
width: 113px;
height: 113px;
background: url(../../image/book/uploading2.png);
position: absolute;
border-radius: 113px;
top: 35px;
left: 35px;
}

 

 

方案二

<div class="uploadimg">
上传中...
</div>

CSS

.uploadimg
{
width:120px;
height:120px;
background:url(../../image/book/uploading3.png);
position:absolute;
top:50%;
left:50%;
margin-left:-180px;
margin-top:-95px;
text-align:center;
line-height:120px;
color:#fff;
display:none;
z-index:10001;
}

 

JS

var index;
function uoloading() {
index = 0;
this.st = window.setInterval(function(){
var x = index%6;
var y = parseInt(index/6)
$(".uploadimg").css({"background-position":-x*120+"px "+ -y*120+"px"});
index ++;
index = index==36 ? 0 : index;
},80);
}

JS实现转动效果

标签:

原文地址:http://www.cnblogs.com/vofill/p/5610191.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!