开发者

CSS Animation: Load second keyframe after first

开发者 https://www.devze.com 2023-04-11 21:37 出处:网络
I study CSS Animations and I have a question. This is my example: http://jsfiddle.net/MBJbB/ Note: Work only in WebKit browsers.

I study CSS Animations and I have a question.

This is my example:

http://jsfiddle.net/MBJbB/ Note: Work only in WebKit browsers.

I have 2 keyframes. I set "first" to repeat 3 times.

After running the "first" keyf开发者_StackOverflowrame of the 3 times, I wanted to call the "second" infinite times.


Edit: joshuanhibbert's answer is more elegant. Use it.

$("#ball").bind("webkitAnimationEnd oAnimationEnd msAnimationEnd animationend", function(){
  $(this).addClass("infinite");
});

And your CSS

#ball.infinite {
  -webkit-animation: second 1s ease-in 0 infinite alternate;
  -moz-animation: second 1s ease-in 0 infinite alternate;
  -o-animation: second 1s ease-in 0 infinite alternate;
  -ms-animation: second 1s ease-in 0 infinite alternate;
  animation: second 1s ease-in 0 infinite alternate;
}

JSfiddle: http://jsfiddle.net/K74TW/

0

精彩评论

暂无评论...
验证码 换一张
取 消