Skip to content
Permalink
Browse files

Tabs: Removed fx option. Fixes #8320 - Tabs: Remove fx option.

  • Loading branch information...
scottgonzalez committed Oct 25, 2012
1 parent acdd191 commit 723d3e0040c46079cedf3998f4e28edfceed7c74
Showing with 0 additions and 71 deletions.
  1. +0 −1 tests/unit/tabs/tabs_common_deprecated.js
  2. +0 −70 ui/jquery.ui.tabs.js
@@ -7,7 +7,6 @@ TestHelpers.commonWidgetTests( "tabs", {
event: "click",
heightStyle: "content",
hide: null,
fx: null,
idPrefix: "ui-tabs-",
panelTemplate: "<div></div>",
// show: null, // conflicts with old show callback
@@ -1207,76 +1207,6 @@ if ( $.uiBackCompat !== false ) {
return this._super( type, event, _data );
}
});

// fx option
// The new animation options (show, hide) conflict with the old show callback.
// The old fx option wins over show/hide anyway (always favor back-compat).
// If a user wants to use the new animation API, they must give up the old API.
$.widget( "ui.tabs", $.ui.tabs, {
options: {
fx: null // e.g. { height: "toggle", opacity: "toggle", duration: 200 }
},

_getFx: function() {
var hide, show,
fx = this.options.fx;

if ( fx ) {
if ( $.isArray( fx ) ) {
hide = fx[ 0 ];
show = fx[ 1 ];
} else {
hide = show = fx;
}
}

return fx ? { show: show, hide: hide } : null;
},

_toggle: function( event, eventData ) {
var that = this,
toShow = eventData.newPanel,
toHide = eventData.oldPanel,
fx = this._getFx();

if ( !fx ) {
return this._super( event, eventData );
}

that.running = true;

function complete() {
that.running = false;
that._trigger( "activate", event, eventData );
}

function show() {
eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" );

if ( toShow.length && fx.show ) {
toShow
.animate( fx.show, fx.show.duration, function() {
complete();
});
} else {
toShow.show();
complete();
}
}

// start out by hiding, then showing, then completing
if ( toHide.length && fx.hide ) {
toHide.animate( fx.hide, fx.hide.duration, function() {
eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
show();
});
} else {
eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
toHide.hide();
show();
}
}
});
}

})( jQuery );

0 comments on commit 723d3e0

Please sign in to comment.
You can’t perform that action at this time.