Forked from gabrysiak/jQuery - Extend addClass to accept callback function
Created
April 2, 2019 20:30
-
-
Save hiphopsmurf/a5298b9acd620d37cb9b093de857abb8 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