CSS3 animation-play-state 属性
暂停动画:
<html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
div {
width: 100px;
height: 100px;
background: red;
position: relative;
animation: mymove 5s;
animation-play-state: paused;
/* Safari and Chrome */
-webkit-animation: mymove 5s;
-webkit-animation-play-state: paused;
}
@keyframes mymove {
from {
left: 0px;
}
to {
left: 200px;
}
}
@-webkit-keyframes mymove
/* Safari and Chrome */
{
from {
left: 0px;
}
to {
left: 200px;
}
}
</style>
</head>
<body>
<p><strong>注意:</strong> animation-play-state属性不兼容 Internet Explorer 9以及更早版本的浏览器.</p>
<div></div>
</body>
</html>
浏览器支持
表格中的数字表示支持该属性的第一个浏览器版本号。
紧跟在 -webkit-, -ms- 或 -moz- 前的数字为支持该前缀属性的第一个浏览器版本号。
属性 | |||||
---|---|---|---|---|---|
animation-play-state | 43.0 4.0 -webkit- |
10.0 | 16.0 5.0 -moz- |
9.0 4.0 -webkit- |
30.0 15.0 -webkit- 12.0 -o- |
标签定义及使用说明
animation--play-state属性指定动画是否正在运行或已暂停。
注意:在JavaScript中使用此属性在一个周期中暂停动画。
默认值: | running |
---|---|
继承: | no |
版本: | CSS3 |
JavaScript 语法: | object object.style.animationPlayState="paused" |
语法
animation-play-state: paused|running;
值 | 描述 | 测试 |
---|---|---|
paused | 指定暂停动画 | 测试 » |
running | 指定正在运行的动画 | 测试 » |
相关文章
CSS3 教程: CSS3 动画