jquery 加载动画效果怎么做
2个回答
展开全部
css3来实现动画效果更高,配上js控制显示隐藏,就模拟出了一个,给你一个示例,js就没有了啊
html:
<div class="loader">
<div class="myloading"></div>
</div>
css:
.loader{width: 100%;height: 100%;position: fixed;z-index: 100;
animation: bgc 4s 1s infinite;-webkit-animation: bgc 4s 1s infinite;-moz-animation: bgc 4s 1s infinite;-o-animation: bgc 4s 1s infinite;-ms-animation: bgc 4s 1s infinite;
animation-fill-mode: both;}
@keyframes bgc{
0%{ background-color: blueviolet; }
25%{ background-color: #B1A25E;}
50%{background-color: #25AEF5;}
75%{background-color: mediumvioletred;}
100%{ background-color: blueviolet; }
}
@-webkit-keyframes bgc{
0%{ background-color: blueviolet; }
25%{ background-color: #B1A25E;}
50%{background-color: #25AEF5;}
75%{background-color: mediumvioletred;}
100%{ background-color: blueviolet; }
}
@-moz-keyframes bgc{
0%{ background-color: blueviolet; }
25%{ background-color: #B1A25E;}
50%{background-color: #25AEF5;}
75%{background-color: mediumvioletred;}
100%{ background-color: blueviolet; }
}
@-ms-keyframes bgc{
0%{ background-color: blueviolet; }
25%{ background-color: #B1A25E;}
50%{background-color: #25AEF5;}
75%{background-color: mediumvioletred;}
100%{ background-color: blueviolet; }
}
@-o-keyframes bgc{
0%{ background-color: blueviolet; }
25%{ background-color: #B1A25E;}
50%{background-color: #25AEF5;}
75%{background-color: mediumvioletred;}
100%{ background-color: blueviolet; }
}
.myloading{ width: 50px;height: 50px;background-color: #FFF;margin: auto;position: absolute;left: 0;top: 0;right: 0;bottom: 0;
animation: load 2s infinite;-webkit-animation: load 2s infinite;-moz-animation: load 2s infinite;-o-animation: load 2s infinite;-ms-animation: load 2s infinite;
animation-fill-mode: both;}
@keyframes load{
0%{transform: perspective(100px) rotateX(0deg) rotateY(0);}
25%{transform: perspective(100px) rotateX(180deg) rotateY(0);}
50%{transform: perspective(100px) rotateX(180deg) rotateY(180deg);}
75%{transform: perspective(100px) rotateX(0) rotateY(180deg);}
100%{transform: perspective(100px) rotateX(0) rotateY(0); }
}
@-webkit-keyframes load{
0%{transform: perspective(100px) rotateX(0deg) rotateY(0);}
25%{transform: perspective(100px) rotateX(180deg) rotateY(0);}
50%{transform: perspective(100px) rotateX(180deg) rotateY(180deg);}
75%{transform: perspective(100px) rotateX(0) rotateY(180deg);}
100%{transform: perspective(100px) rotateX(0) rotateY(0); }
}
@-moz-keyframes load{
0%{transform: perspective(100px) rotateX(0deg) rotateY(0);}
25%{transform: perspective(100px) rotateX(180deg) rotateY(0);}
50%{transform: perspective(100px) rotateX(180deg) rotateY(180deg);}
75%{transform: perspective(100px) rotateX(0) rotateY(180deg);}
100%{transform: perspective(100px) rotateX(0) rotateY(0); }
}
@-o-keyframes load{
0%{transform: perspective(100px) rotateX(0deg) rotateY(0);}
25%{transform: perspective(100px) rotateX(180deg) rotateY(0);}
50%{transform: perspective(100px) rotateX(180deg) rotateY(180deg);}
75%{transform: perspective(100px) rotateX(0) rotateY(180deg);}
100%{transform: perspective(100px) rotateX(0) rotateY(0); }
}
@-ms-keyframes load{
0%{transform: perspective(100px) rotateX(0deg) rotateY(0);}
25%{transform: perspective(100px) rotateX(180deg) rotateY(0);}
50%{transform: perspective(100px) rotateX(180deg) rotateY(180deg);}
75%{transform: perspective(100px) rotateX(0) rotateY(180deg);}
100%{transform: perspective(100px) rotateX(0) rotateY(0); }
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询