Skip to content

Instantly share code, notes, and snippets.

@temp01
Created September 2, 2010 22:22
Show Gist options
  • Save temp01/563077 to your computer and use it in GitHub Desktop.
Save temp01/563077 to your computer and use it in GitHub Desktop.
// .queueEnd( [queueName], callback(jQuerySet) )
jQuery.fn.queueEnd = function(type, callback){
if( !callback ){
callback = type, type = 'fx';
}
var i = 0, $this = this;
return $this.queue(type, function(){
if( ++i == $this.length ){
callback.call( $this );
}
jQuery.dequeue(this, type);
});
};
// example ( http://jsfiddle.net/8QLcx/4/ )
// $('#foo').children().fadeOut('slow').queueEnd(function(){
// console.log('done!');
// });​
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment