Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save akshuvo/80eb265bedac08d38263ef25929a8e95 to your computer and use it in GitHub Desktop.
Save akshuvo/80eb265bedac08d38263ef25929a8e95 to your computer and use it in GitHub Desktop.
// Extend jQuery addClass function to accept callback function
var oAddClass = $.fn.addClass;
$.fn.addClass = function () {
for (var i in arguments) {
var arg = arguments[i];
if ( !! (arg && arg.constructor && arg.call && arg.apply)) {
arg();
delete arg;
}
}
return oAddClass.apply(this, arguments);
}
// Example Usage
// $('.steps li:not(:last)').addClass('complete', function(e){
// console.log(e);
// });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment