是否可以通过mouseover和animate.css对元素进行动画处理?
$(document).ready(function(){
$("p").mouseover(function(){
$("p").css("background-color", "red");
$("#mystyle").animateCss('bounce');
});
$("p").mouseout(function(){
$("p").css("background-color", "gray");
});
});
我尝试过,但是出了点问题。https://jsfiddle.net/f79b7033/
根据animation.css中的文档,您可以使用以下方法扩展jQuery:
$.fn.extend({
animateCss: function (animationName) {
var animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
this.addClass('animated ' + animationName).one(animationEnd, function() {
$(this).removeClass('animated ' + animationName);
});
}
});
而且您没有在代码中添加它。
这是一个工作示例(包括上面的代码):https :
//jsfiddle.net/dekelb/9jaq7fhr/
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句