Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Style animationFillMode Property

Style animationFillMode Property

Style Object Reference The Style object

Example

changing

The animationFillMode property of an element:

document.getElementById("myDIV").style.animationFillMode="forwards";

Try it »


Definition and Usage

The animationFillMode property specifies the style to apply to the element when the animation is not playing (when it has finished, or when it has a delay and has not yet started).

By default, a CSS animation does not affect the element before the first keyframe is played, and stops affecting the element after the last keyframe is complete. The animationFillMode property can override this behavior.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Only Firefox and Opera support the animationFillMode property.


Syntax

Return the animationFillMode property:

object

.style.animationFillMode

Set the animationFillMode property:

object

.style.animationFillMode="none|forwards|backwards|both|initial|inherit"

Attribute values

Value Description
none Default. The animation does not apply any styles to the target element before or after it is executed.
forwards After the animation ends (as determined by animation-iteration-count), the animation will apply this property value.
backwards The animation applies the property values defined in the keyframes of the first iteration that starts during the period defined by animation-delay. These are the values in the from keyframe (when animationDirection is "normal" or "alternate") or the values in the to keyframe (when animationDirection is "reverse" or "alternate-reverse").
both The animation follows the rules for both forwards and backwards. That is, the animation extends the animated properties in both directions.
initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Technical Details

Default value: none
Return Value: A string representing the animation-fill-mode property of the element.
CSS version CSS3

Related Articles

CSS Reference Manual:animation-fill-mode Property


Style Object Reference The Style object