目录

style animationIterationCount 属性

示例

更改 <div> 元素的animationIterationCount 属性:

document.getElementById("myDIV").style.animationIterationCount = "infinite";
亲自试一试 »

描述

AnimationIterationCount 属性设置或返回动画应播放的次数。


语法

返回animationIterationCount属性:

object.style.animationIterationCount

设置animationIterationCount属性:

object.style.animationIterationCount = " number|infinite|initial|inherit"

属性值

Value Description
number A number that defines how many times an animation should be played. Default value is 1
infinite Specifies that the animation should be played infinite times (for ever)
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

技术细节

默认值: 1
返回值: 一个字符串,表示元素的动画迭代计数属性
CSS版本 CSS3

浏览器支持

animationIterationCount是 CSS3 (1999) 的一项功能。

所有浏览器都完全支持它:

Chrome Edge Firefox Safari Opera IE
Yes Yes Yes Yes Yes 11

相关页面

CSS 参考:动画迭代计数属性