Skip to content

Instantly share code, notes, and snippets.

@diego-mi
Created February 14, 2018 16:32
Show Gist options
  • Select an option

  • Save diego-mi/89de4f759b9564643fba7029f8fcdb20 to your computer and use it in GitHub Desktop.

Select an option

Save diego-mi/89de4f759b9564643fba7029f8fcdb20 to your computer and use it in GitHub Desktop.
sobrescrever o evento de addClass para disparar um evento 'cssClassChanged'
// Create a event trigger after change class of element
(function () {
var originalAddClassMethod = jQuery.fn.addClass;
jQuery.fn.addClass = function () {
var result = originalAddClassMethod.apply(this, arguments);
jQuery(this).trigger('cssClassChanged');
return result;
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment