Style animationPlayState 属性

Style 对象参考手册 Style 对象

实例

暂停一个动画:

document.getElementById("myDIV").style.animationPlayState="paused";

尝试一下 »

定义和用法

animationPlayState 属性规定动画是运行的还是暂停的。

注意:使用该属性暂停一个正在播放中的动画。


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Internet Explorer 10、Firefox 和 Opera 支持 animationPlayState 属性。

Safari 和 Chrome 支持另一个可替代该属性的属性,即 WebkitAnimationPlayState 属性。

注意:Internet Explorer 9 及其之前的版本不支持 animationPlayState 属性。


语法

返回 animationPlayState 属性:

object.style.animationPlayState

设置 animationPlayState 属性:

object.style.animationPlayState="running|paused|initial|inherit"

属性值

描述
running默认值。规定动画是运行的。
paused规定动画是暂停的。
initial设置该属性为它的默认值。请参阅 initial
inherit从父元素继承该属性。请参阅 inherit

技术细节

默认值:running
返回值:字符串,表示元素的 animation-play-state 属性。
CSS 版本CSS3


相关文章

CSS 参考手册:animation-play-state 属性


Style 对象参考手册 Style 对象

0 个评论

要回复文章请先登录注册