Style animationFillMode -Eigenschaft
Beispiel
Ändern der Eigenschaft animationFillMode eines <div>-Elements:
document.getElementById("myDIV").style.animationFillMode = "forwards";
Definition und Verwendung
Die Eigenschaft animationFillMode gibt an, welche Stile für das Element gelten, wenn die Animation nicht abgespielt wird (wenn sie beendet ist oder eine „Verzögerung“ vorliegt).
Standardmäßig wirken sich CSS-Animationen nicht auf das Element aus, das Sie animieren, bis der erste Keyframe "abgespielt" wird, und hören dann auf, sich darauf auszuwirken, sobald der letzte Keyframe abgeschlossen ist. Die Eigenschaft animationFillMode kann dieses Verhalten überschreiben.
Browser-Unterstützung
Die Zahlen in der Tabelle geben die erste Browserversion an, die die Eigenschaft vollständig unterstützt.
Zahlen gefolgt von Moz geben die erste Version an, die mit einem Präfix funktioniert hat.
Property | |||||
---|---|---|---|---|---|
animationFillMode | 43.0 | 79.0 | 16.0 5.0 Moz |
9.0 | 30.0 |
Syntax
Geben Sie die Eigenschaft animationFillMode zurück:
object.style.animationFillMode
Legen Sie die Eigenschaft animationFillMode fest:
object.style.animationFillMode = "none|forwards|backwards|both|initial|inherit"
Eigenschaftswerte
Value | Description |
---|---|
none | Default value. The animation will not apply any styles to the target before or after it is executing |
forwards | After the animation ends (determined by animation-iteration-count), the animation will apply the property values for the time the animation ended |
backwards | The animation will apply the property values defined in the keyframe that will start the first iteration of the animation, during the period defined by animation-delay. These are either the values of the from keyframe (when animation-direction is "normal" or "alternate") or those of the to keyframe (when animationDirection is "reverse" or "alternate-reverse") |
both | The animation will follow the rules for both forwards and backwards. That is, it will extend the animation properties in both directions |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Technische Details
Standardwert: | keiner |
---|---|
Rückgabewert: | Ein String, der die Eigenschaft animation-fill-mode eines Elements darstellt |
CSS-Version | CSS3 |
Verwandte Seiten
CSS-Referenz: Eigenschaft animation-fill-mode