纯css3 加载loading动画特效
最近项目中要实现当页面还没有加载完给用户提示正在加载的loading,本来是想做个图片提示的,但是图片如果放大电脑的分辨率就会感觉到很虚,体验效果很不好。于是就采用css3+js实现这个loading的动画效果,最终在我们前端工程师的帮助之下完成。所以记录在这里,如果感兴趣的朋友也可以看看,大家互相焦炉学习。
1、demo.html
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <meta charset="utf-8">
- <link rel="stylesheet" type="text/css" href="./loaders.css">
- <title>纯css3 加载loading动画特效</title>
- </head>
- <body>
- <style>
- body{width:100%;height:100%;margin:0;}
- .fuceng{position:absolute;width:100%;height:100%;margin:0;}
- .loading{margin-left: 50%; margin-top:20%;}
- </style>
- <div>
- <div class="fuceng">
- <div class="loading">
- <div class="loader-inner line-spin-fade-loader">
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- </div>
- </div>
- </div>
- </body>
- </html>
2、loaders.css
- /**
- *
- * All animations must live in their own file
- * in the animations directory and be included
- * here.
- *
- */
- /**
- * Styles shared by multiple animations
- */
- /**
- */
- .ball-spin-fade-loader {
- position: relative; }
- .ball-spin-fade-loader > div:nth-child(1) {
- top: 25px;
- left: 0;
- -webkit-animation: ball-spin-fade-loader 1s 0s infinite linear;
- animation: ball-spin-fade-loader 1s 0s infinite linear; }
- .ball-spin-fade-loader > div:nth-child(2) {
- top: 17.04545px;
- left: 17.04545px;
- -webkit-animation: ball-spin-fade-loader 1s 0.12s infinite linear;
- animation: ball-spin-fade-loader 1s 0.12s infinite linear; }
- .ball-spin-fade-loader > div:nth-child(3) {
- top: 0;
- left: 25px;
- -webkit-animation: ball-spin-fade-loader 1s 0.24s infinite linear;
- animation: ball-spin-fade-loader 1s 0.24s infinite linear; }
- .ball-spin-fade-loader > div:nth-child(4) {
- top: -17.04545px;
- left: 17.04545px;
- -webkit-animation: ball-spin-fade-loader 1s 0.36s infinite linear;
- animation: ball-spin-fade-loader 1s 0.36s infinite linear; }
- .ball-spin-fade-loader > div:nth-child(5) {
- top: -25px;
- left: 0;
- -webkit-animation: ball-spin-fade-loader 1s 0.48s infinite linear;
- animation: ball-spin-fade-loader 1s 0.48s infinite linear; }
- .ball-spin-fade-loader > div:nth-child(6) {
- top: -17.04545px;
- left: -17.04545px;
- -webkit-animation: ball-spin-fade-loader 1s 0.6s infinite linear;
- animation: ball-spin-fade-loader 1s 0.6s infinite linear; }
- .ball-spin-fade-loader > div:nth-child(7) {
- top: 0;
- left: -25px;
- -webkit-animation: ball-spin-fade-loader 1s 0.72s infinite linear;
- animation: ball-spin-fade-loader 1s 0.72s infinite linear; }
- .ball-spin-fade-loader > div:nth-child(8) {
- top: 17.04545px;
- left: -17.04545px;
- -webkit-animation: ball-spin-fade-loader 1s 0.84s infinite linear;
- animation: ball-spin-fade-loader 1s 0.84s infinite linear; }
- .ball-spin-fade-loader > div {
- background-color: #279fcf;
- width: 15px;
- height: 15px;
- border-radius: 100%;
- margin: 2px;
- -webkit-animation-fill-mode: both;
- animation-fill-mode: both;
- position: absolute; }
- @-webkit-keyframes line-spin-fade-loader {
- 50% {
- opacity: 0.3; }
- 100% {
- opacity: 1; } }
- @keyframes line-spin-fade-loader {
- 50% {
- opacity: 0.3; }
- 100% {
- opacity: 1; } }
- .line-spin-fade-loader {
- position: relative; }
- .line-spin-fade-loader > div:nth-child(1) {
- top: 20px;
- left: 0;
- -webkit-animation: line-spin-fade-loader 1.2s 0.12s infinite ease-in-out;
- animation: line-spin-fade-loader 1.2s 0.12s infinite ease-in-out; }
- .line-spin-fade-loader > div:nth-child(2) {
- top: 13.63636px;
- left: 13.63636px;
- -webkit-transform: rotate(-45deg);
- -ms-transform: rotate(-45deg);
- transform: rotate(-45deg);
- -webkit-animation: line-spin-fade-loader 1.2s 0.24s infinite ease-in-out;
- animation: line-spin-fade-loader 1.2s 0.24s infinite ease-in-out; }
- .line-spin-fade-loader > div:nth-child(3) {
- top: 0;
- left: 20px;
- -webkit-transform: rotate(90deg);
- -ms-transform: rotate(90deg);
- transform: rotate(90deg);
- -webkit-animation: line-spin-fade-loader 1.2s 0.36s infinite ease-in-out;
- animation: line-spin-fade-loader 1.2s 0.36s infinite ease-in-out; }
- .line-spin-fade-loader > div:nth-child(4) {
- top: -13.63636px;
- left: 13.63636px;
- -webkit-transform: rotate(45deg);
- -ms-transform: rotate(45deg);
- transform: rotate(45deg);
- -webkit-animation: line-spin-fade-loader 1.2s 0.48s infinite ease-in-out;
- animation: line-spin-fade-loader 1.2s 0.48s infinite ease-in-out; }
- .line-spin-fade-loader > div:nth-child(5) {
- top: -20px;
- left: 0;
- -webkit-animation: line-spin-fade-loader 1.2s 0.6s infinite ease-in-out;
- animation: line-spin-fade-loader 1.2s 0.6s infinite ease-in-out; }
- .line-spin-fade-loader > div:nth-child(6) {
- top: -13.63636px;
- left: -13.63636px;
- -webkit-transform: rotate(-45deg);
- -ms-transform: rotate(-45deg);
- transform: rotate(-45deg);
- -webkit-animation: line-spin-fade-loader 1.2s 0.72s infinite ease-in-out;
- animation: line-spin-fade-loader 1.2s 0.72s infinite ease-in-out; }
- .line-spin-fade-loader > div:nth-child(7) {
- top: 0;
- left: -20px;
- -webkit-transform: rotate(90deg);
- -ms-transform: rotate(90deg);
- transform: rotate(90deg);
- -webkit-animation: line-spin-fade-loader 1.2s 0.84s infinite ease-in-out;
- animation: line-spin-fade-loader 1.2s 0.84s infinite ease-in-out; }
- .line-spin-fade-loader > div:nth-child(8) {
- top: 13.63636px;
- left: -13.63636px;
- -webkit-transform: rotate(45deg);
- -ms-transform: rotate(45deg);
- transform: rotate(45deg);
- -webkit-animation: line-spin-fade-loader 1.2s 0.96s infinite ease-in-out;
- animation: line-spin-fade-loader 1.2s 0.96s infinite ease-in-out; }
- .line-spin-fade-loader > div {
- background-color: #279fcf;
- width: 4px;
- height: 35px;
- border-radius: 2px;
- margin: 2px;
- -webkit-animation-fill-mode: both;
- animation-fill-mode: both;
- position: absolute;
- width: 5px;
- height: 15px; }
3、效果图
纯css3 加载loading动画特效的更多相关文章
- 页面预加载loading动画,再载入内容
默认情况下如果网站请求速度慢,所以会有一段时间的空白页面等等,用户体验效果不好,见到很多的页面都有预加载的效果,加载之前先加载一个动画,后台进程继续加载页面内容,当页面内容加载完之后再退出动画显示内容 ...
- 纯css3加载动画
<!DOCTYPE html><html> <head> <meta charset="utf-8"> <meta name= ...
- 2014圣诞节一款纯css3实现的雪人动画特效
在2014年的圣诞节,爱编程小编给大家分分享一款纯css3实现的雪人动画特效.该实例实现一个雪人跳动的特效,效果图如下: 在线预览 源码下载 实现的代码. html代码: <span cla ...
- [Swift通天遁地]五、高级扩展-(11)图像加载Loading动画效果的自定义和缓存
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...
- 页面加载loading动画
关于页面加载的loading动画,能度娘到的大部分都是通过定时器+蒙层实现的,虽然表面上实现了动画效果,实际上动化进程和页面加载进程是没有什么关系的,只是设置几秒钟之后关闭蒙层,但假如页面须要加载的元 ...
- css3加载ing动画
项目中ajax交互成功前总会需要给用户提醒,比如请稍候.正在加载中等等,那个等待的动图以前项目中用的是gif,在移动端画质很渣,有毛边,于是在新项目中用css3展示加载中的动画效果. function ...
- CSS3扁平化Loading动画特效
效果预览:http://hovertree.com/texiao/css3/42/ 代码如下: <!doctype html> <html> <head> < ...
- 兼容ie10及以上css3加载进度动画
html <div class="spinner"> <div class="rect1"></div> < ...
- 各种加载效果,适合做加载loading动画效果 Eclipse版
Animation.rar 链接: http://pan.baidu.com/s/1c0QkOz2 密码: kd57
随机推荐
- BZOJ-1087 互不侵犯King 状压DP+DFS预处理
1087: [SCOI2005]互不侵犯King Time Limit: 10 Sec Memory Limit: 162 MB Submit: 2337 Solved: 1366 [Submit][ ...
- 【poj1962】 Corporative Network
http://poj.org/problem?id=1962 (题目链接) 时隔多年又一次写带权并查集. 题意 n个节点,若干次询问,I x y表示从x连一条边到y,权值为|x-y|%1000:E x ...
- TYVJ1000 A+B problem [存个高精模板]
A+B Problem! 通过模拟我故乡非洲的计算方式,我们很快可以解决这道题. #include<iostream> #include<cstdio> #include< ...
- event driven的一些概念
1. event :Something that happens during your application that requires a response. 2.event object:Th ...
- 透透彻彻IoC(你没有理由不懂!)
http://www.myexception.cn/open-source/418322.html 引述:IoC(控制反转:Inverse of Control)是Spring容器的内核,AOP.声明 ...
- 嵌入式实时操作系统μCOS原理与实践任务控制与时间的解析
/*************************************************************************************************** ...
- MyEclipse使用SVN进行项目版本控制
一.搭建SVN服务器. 例如,使用VisualSVN Server,下载后安装. (1)在Repositories(版本库)上右击,新建Repository,选择Regular FSFS reposi ...
- Ext.Net学习笔记24:在ASP.NET MVC中使用Ext.Net
在前面的笔记中已经介绍了如何在ASP.NET WebForm中使用Ext.Net,由于这个系列一直在WebForm中使用,所以并没有涉及到ASP.NET MVC中的用法. 如果你要在ASP.NET M ...
- C++_Eigen函数库用法笔记——Block Operations
Using block operations rvalue, i.e. it was only read from lvalues, i.e. you can assign to a block Co ...
- XML做下拉列表
5-18X.php主页面 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http: ...