mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Tabs: Removed fx option. Fixes #8320 - Tabs: Remove fx option.
This commit is contained in:
parent
acdd1917b2
commit
723d3e0040
@ -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
|
||||
|
70
ui/jquery.ui.tabs.js
vendored
70
ui/jquery.ui.tabs.js
vendored
@ -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 );
|
||||
|
Loading…
Reference in New Issue
Block a user