toggle: function( state, fn2 ) {
var bool = typeof state === "boolean";
- if ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) {
- return eventsToggle.apply( this, arguments );
- }
-
return this.each(function() {
if ( bool ? state : isHidden( this ) ) {
jQuery( this ).show();
return jQuerySub;
};
-jQuery.fn.toggle = function( fn ) {
+var oldToggle = jQuery.fn.toggle;
+jQuery.fn.toggle = function( fn, fn2 ) {
+
+ if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) {
+ return oldToggle.apply( this, arguments );
+ }
+
// Save reference to arguments for access in closure
var args = arguments,
guid = fn.guid || jQuery.guid++,
jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
var cssFn = jQuery.fn[ name ];
jQuery.fn[ name ] = function( speed, easing, callback ) {
- return speed == null || typeof speed === "boolean" ||
- // special check for .toggle( handler, handler, ... )
- ( !i && jQuery.isFunction( speed ) && jQuery.isFunction( easing ) ) ?
+ return speed == null || typeof speed === "boolean" ?
cssFn.apply( this, arguments ) :
this.animate( genFx( name, true ), speed, easing, callback );
};