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

animationstart Event

animationstart Event

Event Object Reference Event Object

Example

After the CSS animation starts playing, for the

element, add a listener event:

var

x

=

document

.

getElementById

(

"

myDIV

"

)

;

//

Chrome, Safari and Opera code

x

.

addEventListener

(

"

webkitAnimationStart

"

,

myStartFunction

)

;

//

Standard syntax

x

.

addEventListener

(

"

animationstart

"

,

myStartFunction

)

;

Try it »


Definition and Usage

The animationstart event is triggered when the CSS animation starts playing.

For more about CSS animations, please see our CSS3 Animations section.

When a CSS animation plays, the following three events occur:

  • animationstart - Triggered when the CSS animation starts
  • animationiteration - Triggered when the CSS animation repeats
  • animationend - Triggered when the CSS animation completes

Browser support

The numbers in the table indicate the version number of the first browser to support the event.

The number specified after "webkit" or "moz" is the prefix of the first version to support the event.

Events
animationstart 4.0 webkit 10.0  16.0
5.0 moz 4.0 webkit 15.0 webkit
12.1

Note: The Chrome, Safari and Opera browsers use the webkitAnimationEnd prefix.


Syntax



object.addEventListener("webkitAnimationStart", myScript);  // Chrome, Safari 与 Opera 语法

object.addEventListener("animationstart", myScript);        // 标准语法

Note: Internet Explorer 8 and earlier IE versions do not support addEventListener() method.


Technical Details

Does it support bubbling: Yes
Is it cancelable: No
Event type: AnimationEvent

Related pages

CSS Tutorial: CSS3 Animations

CSS Reference Manual: CSS3 Animation Properties

HTML DOM Reference Manual: Style Animation Properties

Event Object Reference Event Object