Skip to content

Instantly share code, notes, and snippets.

@simplelife7
Created December 3, 2013 02:54
Show Gist options
  • Save simplelife7/7763195 to your computer and use it in GitHub Desktop.
Save simplelife7/7763195 to your computer and use it in GitHub Desktop.
【JS】判断动画animate是否结束函数
(function($){
/**
* 绑定css3的animateend事件
* @public
* @function
* @name $.fn.onAnimated
* @param {Function} cbk 事件处理函数
*/
$.fn.onAnimated = function (cbk) {
return this.each(function(){
if (cbk === false) {
$(this).unbind("animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd");
return;
}
$(this).bind("animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd",cbk);
});
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment