Bug Tracker

Changeset 5350

Show
Ignore:
Timestamp:
04/29/08 21:35:35 (7 months ago)
Author:
aflesler
Message:

jquery event: jQuery.toggle can accept more than 2 functions, closes #2378

Location:
trunk/jquery/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/jquery/src/event.js

    r5344 r5350  
    444444        return this.click(function(event) { 
    445445            // Figure out which function to execute 
    446             this.lastToggle = 0 == this.lastToggle ? 1 : 0; 
     446            this.lastToggle = (this.lastToggle||0) % args.length; 
    447447             
    448448            // Make sure that clicks stop 
     
    450450             
    451451            // and execute the function 
    452             return args[this.lastToggle].apply( this, arguments ) || false; 
     452            return args[this.lastToggle++].apply( this, arguments ) || false; 
    453453        }); 
    454454    }, 
  • trunk/jquery/src/fx.js

    r5317 r5350  
    3636    toggle: function( fn, fn2 ){ 
    3737        return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ? 
    38             this._toggle( fn, fn2 ) : 
     38            this._toggle.apply( this, arguments ) : 
    3939            fn ? 
    4040                this.animate({