CSS3提交按钮等待打点循环效果

快乐打工仔 分类:实例代码
本章节分享一段代码实例,它实现了提交按钮打点等待效果。

这样的效果是比较人性化的,可以让用户很容易的指导,网页是在工作中,只需要耐心等待就可以。

代码实例如下:

<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<meta name="author" content="http://www.pipipi.net/" />
<title>前端教程网</title>
<style type="text/css">
.grebtn {
  display:inline-block;
  padding:0.25em 1.25em;
  border:1px solid;
  border-radius:2px;
  vertical-align:bottom;
  font-weight:inherit;
  border-color:#208000 #1F7F00;
  background-color:#289600;
  box-shadow:inset 0 0 1px rgba(255,255,255,.6), 0 1px #8DBF62;
  color:#fff;
  text-shadow:0 -1px #137900;
  text-decoration:none;
 
}
.dotting {
  display:inline-block;
  min-width:2px;
  min-height:2px;
  box-shadow:2px 0 currentColor, 6px 0 currentColor, 10px 0 currentColor;
  -webkit-animation:dot 4s infinite step-start both;
  animation:dot 4s infinite step-start both;
  *zoom: expression(this.innerHTML = '...'); /* IE7 */
}
.dotting:before { content: '...'; } /* IE8 */
.dotting::before { content: ''; }
:root .dotting { margin-right: 8px; } /* IE9+,FF,CH,OP,SF */
 
@-webkit-keyframes dot {
  25% { box-shadow: none; }
  50% { box-shadow: 2px 0 currentColor; }
  75% { box-shadow: 2px 0 currentColor, 6px 0 currentColor; }
}
@keyframes dot {
  25% { box-shadow: none; }
  50% { box-shadow: 2px 0 currentColor; }
  75% { box-shadow: 2px 0 currentColor, 6px 0 currentColor; }
}
</style>
<head>
</head>
<body>
<a href="javascript:" class="grebtn">订单提交中<span class="dotting"></span></a>
</body>
</html>

回复

我来回复
  • 暂无回复内容