admin管理员组文章数量:1434388
How can I start CSS animations with js? the first line (webkitAnimation) works but the other ones don't.
anim_logo.style.webkitAnimation="threesixty 3s";
anim_logo.style.mozAnimation="threesixty 3s";
anim_logo.style.oAnimation="threesixty 3s";
anim_logo.style.animation="threesixty 3s";
why?
live preview (Click on the Ninja Star)
How can I start CSS animations with js? the first line (webkitAnimation) works but the other ones don't.
anim_logo.style.webkitAnimation="threesixty 3s";
anim_logo.style.mozAnimation="threesixty 3s";
anim_logo.style.oAnimation="threesixty 3s";
anim_logo.style.animation="threesixty 3s";
why?
live preview (Click on the Ninja Star)
Share Improve this question edited Oct 12, 2012 at 20:26 atomikpanda asked Oct 12, 2012 at 20:10 atomikpandaatomikpanda 1,8865 gold badges35 silver badges47 bronze badges 2- I can't deduce a specific question here, but for animation, jQuery's various effect calls are good places to start... – blackcatweb Commented Oct 12, 2012 at 20:14
- 1 Could you please check if you put the second or the last one first if it works in firefox? – xception Commented Oct 12, 2012 at 20:26
1 Answer
Reset to default 7You better make a separate class with that animation and simply attach it to your element when needed:
anim_logo.setAttribute("class", yourAnimationClass);
UPDATE
To remove the newly added class you can use a delayed function:
function animateMe() {
anim_logo.setAttribute( "class", yourAnimationClass );
setTimeout( function() {
anim_logo.setAttribute( "class", "" );
}, 3000);
}
本文标签: htmlStart CSS Animations JavaScriptStack Overflow
版权声明:本文标题:html - Start CSS Animations JavaScript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745634010a2667442.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论