

#
“onanimationcancel”イベントハンドラ
イベント名 | “animationcancel”イベント |
インターフェース | “AnimationEvent”インターフェース |
バブリング | Yes |
キャンセル | No |
“onanimationcancel”イベントハンドラはCSSの“animation”プロパティなどによるアニメーションの再生が中止されたときに発生する“animationcancel”イベントを処理するためのイベントハンドラです。
“animationcancel”イベントは“animation-name”プロパティの値が変更されるなどしてアニメーションが最後まで再生された時に発生する“animationend”イベントが発生せずに終わる場合に発生します。
“onanimationcancel”イベントハンドラはすべてのHTMLの要素でコンテント属性とIDL属性として使用できます。また、すべての“Document”オブジェクトと“Window”オブジェクトでIDL属性として使用できます。
#
サンプルコード
IDL属性
var count = 0;
document.getElementById("sampleElement").onanimationcancel = function() {
count++;
document.getElementById("counterNumber").innerHTML = count;
};

コンテント属性
<div onanimationcancel="counter();">♪</div>
<p>イベントの発生回数:<output id="counterNumber">0</output>回</p>

#