Created
April 10, 2010 01:51
-
-
Save StevenBlack/361765 to your computer and use it in GitHub Desktop.
jQuery special events example
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
// 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