Forked from gabrysiak/jQuery - Extend addClass to accept callback function
Created
July 7, 2019 17:46
-
-
Save akshuvo/80eb265bedac08d38263ef25929a8e95 to your computer and use it in GitHub Desktop.
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
// 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