diff options
author | Mr Speaker <mrspeaker@gmail.com> | 2009-11-11 09:46:24 -0500 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2009-11-11 09:46:24 -0500 |
commit | 5cb1163469fb2c9cd80712cd5481b29055821022 (patch) | |
tree | 5cd6531ea6e05537ce79b3c8afb58ac4227841ea /src/event.js | |
parent | 4b55e94d0849568a2fd121952f13a9d6571c731f (diff) | |
download | jquery-5cb1163469fb2c9cd80712cd5481b29055821022.tar.gz jquery-5cb1163469fb2c9cd80712cd5481b29055821022.zip |
Making sure that you can bind multiple toggles to a single element without problems. Thanks to 'Mr Speaker' for the original patch. Fixes #5274.
Diffstat (limited to 'src/event.js')
-rw-r--r-- | src/event.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/event.js b/src/event.js index 7cfb535b6..e2087cc13 100644 --- a/src/event.js +++ b/src/event.js @@ -693,13 +693,14 @@ jQuery.fn.extend({ return this.click( jQuery.event.proxy( fn, function( event ) { // Figure out which function to execute - this.lastToggle = ( this.lastToggle || 0 ) % i; + var lastToggle = ( jQuery.data( this, 'lastToggle' + fn.guid ) || 0 ) % i; + jQuery.data( this, 'lastToggle' + fn.guid, lastToggle + 1 ); // Make sure that clicks stop event.preventDefault(); // and execute the function - return args[ this.lastToggle++ ].apply( this, arguments ) || false; + return args[ lastToggle ].apply( this, arguments ) || false; })); }, |