博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
JS实现转动效果
阅读量:4703 次
发布时间:2019-06-09

本文共 1275 字,大约阅读时间需要 4 分钟。

方案一

<div class="div_uploading">

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

 

CSS样式

@keyframes scroll

{
0% {transform:rotate(0deg);}
100% {transform:rotate(360deg);}
}

.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);
}

转载于:https://www.cnblogs.com/vofill/p/5610191.html

你可能感兴趣的文章
使用Siege进行WEB压力测试
查看>>
斑马为什么有条纹?
查看>>
android多层树形结构列表学习笔记
查看>>
Android_去掉EditText控件周围橙色高亮区域
查看>>
《构建之法》第一、二、十六章阅读笔记
查看>>
arrow:让Python的日期与时间变的更好
查看>>
(转)Excel的 OleDb 连接串的格式(连接Excel 2003-2013)
查看>>
Java并发编程
查看>>
Git Stash用法
查看>>
sql server 2008学习8 sql server存储和索引结构
查看>>
Jquery radio选中
查看>>
memcached 细究(三)
查看>>
RSA System.Security.Cryptography.CryptographicException
查看>>
webservice整合spring cxf
查看>>
[解题报告] 100 - The 3n + 1 problem
查看>>
Entity Framework 学习高级篇1—改善EF代码的方法(上)
查看>>
Mybatis逆向工程配置文件详细介绍(转)
查看>>
String类的深入学习与理解
查看>>
不把DB放进容器的理由
查看>>
OnePage收集
查看>>