我们在提交数据的时候,在开始提交数据与数据提交成功之间会有一段时间间隔,为了有更好的用户体验,我们可以在这个时间段添加一个那处点点点的动画,如下图所示:

汇总了一下实现这种效果主要有三种方法:

第一种:box-shadow + animate;

第二种:animate;

第三种:等宽字体 + animate

具体代码如下:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>实现loadingh点点点的效果</title>
<style type="text/css">
/* box-shadow+animate方法 */
.shadow_dot {
display: inline-block; min-width: 2px; min-height: 2px;
box-shadow: 2px 0 currentColor, 6px 0 currentColor, 10px 0 currentColor;
-webkit-animation: shadow_dot 4s infinite step-start both;
animation: shadow_dot 4s infinite step-start both;
*zoom: expression(this.innerHTML = '...'); /* IE7 */
}
.shadow_dot:before { content: '...'; } /* IE8 */
.shadow_dot::before { content: ''; }
:root .shadow_dot { margin-right: 8px; } /* IE9+,FF,CH,OP,SF */ @-webkit-keyframes shadow_dot {
25% { box-shadow: none; }
50% { box-shadow: 2px 0 currentColor; }
75% { box-shadow: 2px 0 currentColor, 6px 0 currentColor; }
}
@keyframes shadow_dot {
25% { box-shadow: none; }
50% { box-shadow: 2px 0 currentColor; }
75% { box-shadow: 2px 0 currentColor, 6px 0 currentColor; }
} /* animate方法 */
.ani_dot {
font-family: simsun;
}
:root .ani_dot { /* 这里使用Hack是因为IE6~IE8浏览器下, vertical-align解析不规范,值为bottom或其他会改变按钮的实际高度*/
display: inline-block;
width: 1.5em;
vertical-align: bottom;
overflow: hidden;
}
@-webkit-keyframes dot {
0% { width: 0; margin-right: 1.5em; }
33% { width: .5em; margin-right: 1em; }
66% { width: 1em; margin-right: .5em; }
100% { width: 1.5em; margin-right: 0;}
}
.ani_dot {
-webkit-animation: dot 3s infinite step-start;
} @keyframes dot {
0% { width: 0; margin-right: 1.5em; }
33% { width: .5em; margin-right: 1em; }
66% { width: 1em; margin-right: .5em; }
100% { width: 1.5em; margin-right: 0;}
}
.ani_dot {
animation: dot 3s infinite step-start;
} /* 等宽字体+animate方法 */
dot {
display: inline-block;
width: 3ch;
text-indent: -1ch;
vertical-align: bottom;
overflow: hidden;
animation: dot 3s infinite step-start both;
/* 等宽字体很重要 */
font-family: Consolas, Monaco, monospace;
} @keyframes dot {
33% { text-indent: 0; }
66% { text-indent: -2ch; }
} </style>
</head>
<body>
<h3>利用box-shadow实现:</h3>
<div>
数据提交中<span class="shadow_dot"></span>
</div> <h3>animate方法:</h3>
<div>
数据提交中<span class="ani_dot">...</span>
</div> <h3>等宽字体+animate方法:</h3>
<div>
数据提交中<span>...</span>
</div>
</body>
</html>

大家可以自己动手实践一下~~

这三种方法来源地址如下:

再说CSS3 animation实现点点点loading动画

小tip: CSS3 animation渐进实现点点点等待提示效果

等宽字体在web布局中应用以及CSS3 ch单位嘿嘿

三种CSS方法实现loadingh点点点的效果的更多相关文章

  1. Liunx 环境下vsftpd的三种实现方法(超详细参数)

    以下文章介绍Liunx 环境下vsftpd的三种实现方法 ftp://vsftpd.beasts.org/users/cevans/vsftpd-2.0.3.tar.gz,目前已经到2.0.3版本.假 ...

  2. javase-常用三种遍历方法

    javase-常用三种遍历方法 import java.util.ArrayList; import java.util.Iterator; import java.util.List; public ...

  3. JS面向对象(3) -- Object类,静态属性,闭包,私有属性, call和apply的使用,继承的三种实现方法

    相关链接: JS面向对象(1) -- 简介,入门,系统常用类,自定义类,constructor,typeof,instanceof,对象在内存中的表现形式 JS面向对象(2) -- this的使用,对 ...

  4. Java中Map的三种遍历方法

    Map的三种遍历方法: 1. 使用keySet遍历,while循环: 2. 使用entrySet遍历,while循环: 3. 使用for循环遍历.   告诉您们一个小秘密: (下↓面是测试代码,最爱看 ...

  5. Jquery中each的三种遍历方法

    Jquery中each的三种遍历方法 $.post("urladdr", { "data" : "data" }, function(dat ...

  6. spring与mybatis三种整合方法

    spring与mybatis三种整合方法 本文主要介绍Spring与Mybatis三种常用整合方法,需要的整合架包是mybatis-spring.jar,可通过链接 http://code.googl ...

  7. C#使用DataSet Datatable更新数据库的三种实现方法

    本文以实例形式讲述了使用DataSet Datatable更新数据库的三种实现方法,包括CommandBuilder 方法.DataAdapter 更新数据源以及使用sql语句更新.分享给大家供大家参 ...

  8. struts2拦截器interceptor的三种配置方法

    1.struts2拦截器interceptor的三种配置方法 方法1. 普通配置法 <struts> <package name="struts2" extend ...

  9. selenium webdriver三种等待方法

    webdriver三种等待方法 1.使用WebDriverWait from selenium import webdriverfrom selenium.webdriver.common.by im ...

随机推荐

  1. MSCRM 2011 JavaScript 开发文档

    watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvem91eXVqaWUxMTI3/font/5a6L5L2T/fontsize/400/fill/I0JBQk ...

  2. Drawing points

    A point is the most simple graphics object that can be drawn. It is a small spot on the window. #!/u ...

  3. keepalived 使用注意事项

    1.启动用service keepalived start/stop 比直接 /sbin/keepalived start/stop要好,貌似解决了master停止了keepalived服务而back ...

  4. Redis源代码剖析和凝视(八)--- 对象系统(redisObject)

    Redis 对象系统 1. 介绍 redis中基于双端链表.简单动态字符串(sds).字典.跳跃表.整数集合.压缩列表.高速列表等等数据结构实现了一个对象系统,而且实现了5种不同的对象,每种对象都使用 ...

  5. Tomcat 关闭时报错

    最近tomcat走普通的关闭方式无法正常关闭,会报一些Error,用的是Tomcat7,据说是Tomcat7在关闭的时候加了一些检查线程泄漏内存泄露的东西 总结起来,在我项目中有这么几个原因会导致关闭 ...

  6. 【Leet Code】Palindrome Number

    Palindrome Number Total Accepted: 19369 Total Submissions: 66673My Submissions Determine whether an ...

  7. 【jQuery获取下拉框select、单选框radio、input普通框的值和checkbox选中的个数】

    radio单选框:name属性相同 <input type="radio" id="sp_type" name="p_type" va ...

  8. jquery api 常见api 元素操作例子

    append_prepend.html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> ...

  9. 关注C++细节——C++11新标准之decltype的使用注意

    c++11新特性--decltype decltype是C++11加入的一个新的keyword,目的是选择并返回操作数的数据类型,重要的是,在此过程中编译器分析表达式并得到它的类型,却不实际计算表达式 ...

  10. WEP无线网络密码破解

    一,五分钟实现无线WEP入侵的特点: 众所周知WEP加密入侵需要用户通过监听等方法接收到足够数量的WEP验证数据包,然后通过分析软件使用暴力破解的方法穷举法还原出WEP加密密钥的明文信息.五分钟实现无 ...