animation-play-state [对象动画的状态]


语法

animation-play-state: running | paused  检索或设置对象动画的状态。
语法项目说明
初始值running
适用于所有元素
可否继承
媒介视觉
版本CSS3.0

说明

animation-play-state检索或设置对象动画的状态,如果提供多个属性值,以逗                号进行分隔。

取值

running:默认值。运动

paused:暂停

实例代码

CSS
  1. .play-state{
  2.     -webkit-animation:f1 2s 0.5s 2  linear forwards alternate;
  3.     -moz-animation:f1 2s 0.5s 2  linear forwards alternate;
  4.     position:relative;
  5.     left:10px;
  6.     width:100px;
  7.     height:100px;
  8.     margin:10px 0;
  9.     overflow:hidden;
  10. }
  11. .play-state:hover{ 
  12.     -webkit-animation-play-state:paused;
  13.     -moz-animation-play-state:paused;
  14. }
  15. @-webkit-keyframes f1{
  16.     0%{left:10px;}
  17.     100%{left:500px;}
  18. }
  19. @-moz-keyframes f1{
  20.     0%{left:10px;}
  21.     100%{left:500px;}
  22. }
HTML
  1. <div class="demo_box play-state">鼠标移过来我就停,移走就运动,好听话哦!</div>
运行一下 »

兼容性

IEFirefoxOperaSafariChrome
IE 10+Firefox 3.5+目前暂无版本支持Safari 10+Chrome 2.0+