Created
April 28, 2013 12:05
-
-
Save mt3o/5476695 to your computer and use it in GitHub Desktop.
Attach event before and after class change with jquery
This file contains 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
(function(){ | |
// Your base, I'm in it! | |
var originalAddClassMethod = jQuery.fn.addClass; | |
jQuery.fn.addClass = function(){ | |
jQuery(this).trigger('beforeCssClassChanged'); | |
var result = originalAddClassMethod.apply( this, arguments ); | |
jQuery(this).trigger('afterCssClassChanged'); | |
// return the original result | |
return result; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment