Created
August 14, 2014 19:44
-
-
Save gabrysiak/166befef3264d0c53f47 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
great! but why does not accept the $(this) parameter in the function?