LoginSignup
42
44

More than 5 years have passed since last update.

CSS3アニメーションのイベントを取得する

Last updated at Posted at 2015-08-28

アニメーション開始

var selector = document.querySelector("#example");
selector.addEventListener("animationstart",function(e){
    // animation start
});

アニメーション中

var selector = document.querySelector("#example");
selector.addEventListener("animationiteration",function(e){
    // animation iteration (step)
});

アニメーション終了

var selector = document.querySelector("#example");
selector.addEventListener("animationend",function(e){
    // animation end
});

トランジション開始

var selector = document.querySelector("#example");
selector.addEventListener("transitionstart",function(e){
    // transition start
});

トランジション中(ない??これが一番欲しい)

// var selector = document.querySelector("#example");
// selector.addEventListener("transitioniteration",function(e)// {
//     // transition iteration (step)
// });

トランジション終了

var selector = document.querySelector("#example");
selector.addEventListener("transitionend",function(e){
    // transition end
});

参考

注意

webkitとかベンダープリフィックスが必要みたい
イベント名が違うので注意

42
44
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
42
44