Skip to content

Instantly share code, notes, and snippets.

@StevenBlack
Created April 10, 2010 01:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StevenBlack/361765 to your computer and use it in GitHub Desktop.
Save StevenBlack/361765 to your computer and use it in GitHub Desktop.
jQuery special events example
// Special events
(function($){
// Special event definition.
$.event.special.click = {
setup: function() {
// This is only done the first time a "click" event handler is bound,
// per-element.
$(this).css( 'cursor', 'pointer' );
// Bind the "click" event normally.
return false;
},
teardown: function() {
// This is only done the last time a "click" event handler is unbound,
// per-element.
$(this).css( 'cursor', '' );
// Unbind the "click" event normally.
return false;
}
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment