Skip to content

Instantly share code, notes, and snippets.

@smwhr
Created March 28, 2015 17:05
Show Gist options
  • Save smwhr/e8755064082d88e35925 to your computer and use it in GitHub Desktop.
Save smwhr/e8755064082d88e35925 to your computer and use it in GitHub Desktop.
Ontransitionend
jQuery.fn.extend({
ontransitionend: function(callback) {
var transitionEvent='webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend';
return this.each(function() {
var self = jQuery(this);
self.one(transitionEvent,
function(e) {
self.off(transitionEvent);
callback.call(self);
});
});
}
});
jQuery(dom).ontransitionend(function(){
this.addClass('done');
})
jQuery(dom).addClass('transitionning-class')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment