Created
December 3, 2013 02:51
-
-
Save simplelife7/7763179 to your computer and use it in GitHub Desktop.
【JS】判断动画transition是否结束函数
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($){ | |
/** | |
* transitionend | |
* @public | |
* @function | |
* @name $.fn.onTransitioned | |
* @param {Function} cbk 事件处理函数 | |
*/ | |
$.fn.onTransitioned = function (cbk) { | |
return this.each(function () { | |
if (cbk===false) { | |
$(this).unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"); | |
return; | |
} | |
$(this).bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd", cbk); | |
}); | |
}; | |
})(jQuery); | |
$('.xxx').onTransitioned(function(){ | |
$(this).onTansitioned(false).addClass('yyy'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment