Hello.
Some times we need to make toggle not only to click events.

So I change the jQuery Code at line 2993-2954 to:
        toggle: function( fn ) {
                // Save reference to arguments for access in closure
                var args = arguments, i = 1;

                //I added This 2 lines:*********************************
                var event='click';
                if (!$.isFunction(fn)) {event=fn;fn=args
[1];args=Array.prototype.slice.call( args,1 ) }

                // link all the functions, so any of them can unbind this click
handler
                while( i < args.length )
                        jQuery.event.proxy( fn, args[i++] );

                //I changed The next line:*********************************
                return this[event]( jQuery.event.proxy( fn, function(event) {
                        // Figure out which function to execute
                        this.lastToggle = ( this.lastToggle || 0 ) % i;

                        // Make sure that clicks stop
                        event.preventDefault();

                        // and execute the function
                        return args[ this.lastToggle++ ].apply( this, arguments 
) || false;
                }));
        },

//------------------------------
It's worked great for me, when I am using this code:

$('button')._toggle('mouseover',
function(){alert(0)},
function(){alert(1)}
)


Do you want to accept this change?
I didn't success to set the normal $("").toogle function to work (only
_toggle), becuase jQuery think that I am trying to make a toggle
animation.

Thank you.

Reply via email to