Dan*_*cut 5 html css jquery animation css3
我在css中创建了一个旋转动画,它采用1s并且使用类.comet设置了"前进".如何在每次点击外部元素时启动动画?
#carousel #big_bubble #cometa.rotation{animation:rotation 1s forwards; -moz-animation:rotation 1.5s forwards; -webkit-animation:rotation 1s forwards; -o-animation:rotation forwards 1s; }
@-moz-keyframes rotation{
from{transform:rotate(0deg);}
to{transform:rotate(-360deg);}
@-webkit-keyframes rotation{
from{-webkit-transform:rotate(0deg);}
to{-webkit-transform:rotate(-360deg);}
}
Run Code Online (Sandbox Code Playgroud)
$(function() {// Shorthand for $( document ).ready()
$( ".trigger" ).click(function(e) {
e.preventDefault();
$(this).addClass( "animation" ).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend", function(){
$(this).removeClass( "animation" );
});
});
});
Run Code Online (Sandbox Code Playgroud)
资源:
| 归档时间: |
|
| 查看次数: |
8244 次 |
| 最近记录: |