mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
jquery event: jQuery.toggle can accept more than 2 functions, closes #2378
This commit is contained in:
parent
e9c620794f
commit
c3cbc5bf98
@ -443,13 +443,13 @@ jQuery.fn.extend({
|
||||
|
||||
return this.click(function(event) {
|
||||
// Figure out which function to execute
|
||||
this.lastToggle = 0 == this.lastToggle ? 1 : 0;
|
||||
this.lastToggle = (this.lastToggle||0) % args.length;
|
||||
|
||||
// Make sure that clicks stop
|
||||
event.preventDefault();
|
||||
|
||||
// and execute the function
|
||||
return args[this.lastToggle].apply( this, arguments ) || false;
|
||||
return args[this.lastToggle++].apply( this, arguments ) || false;
|
||||
});
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user