// init jQuery UI TabMenu
self._containers[$containerID] = $tabMenu;
$tabMenu.wcfTabs({
+ active: false,
select: function(event, ui) {
var $panel = $(ui.panel);
var $container = $panel.closest('.tabMenuContainer');
break;
}
- $tabMenu = $tabMenu.data('parent').wcfTabs('select', $tabMenu.wcfIdentify());
+ $tabMenu = $tabMenu.data('parent').wcfTabs('selectTab', $tabMenu.wcfIdentify());
}
return true;
if ($subIndex !== null) {
if ($tabMenuItem.hasClass('tabMenuContainer')) {
- $tabMenuItem.wcfTabs('select', $tabMenu.data('active'));
+ $tabMenuItem.wcfTabs('selectTab', $tabMenu.data('active'));
}
else {
- $tabMenu.wcfTabs('select', $tabMenu.data('active'));
+ $tabMenu.wcfTabs('selectTab', $tabMenu.data('active'));
}
}
if ($tabMenu.length === 1 && $tabMenu.hasClass('ui-tabs-panel')) {
$tabMenu = $tabMenu.parent('.ui-tabs');
if ($tabMenu.length) {
- $tabMenu.wcfTabs('select', $hash);
+ $tabMenu.wcfTabs('selectTab', $hash);
// check if this is a nested tab menu
if ($tabMenu.hasClass('ui-tabs-panel')) {
$hash = $tabMenu.wcfIdentify();
$tabMenu = $tabMenu.parent('.ui-tabs');
if ($tabMenu.length) {
- $tabMenu.wcfTabs('select', $hash);
+ $tabMenu.wcfTabs('selectTab', $hash);
}
}
$.ui.tabs.prototype.select.apply(this, arguments);
},
+ /**
+ * Selects a specific tab by triggering the 'click' event.
+ *
+ * @param string tabIdentifier
+ */
+ selectTab: function(tabIdentifier) {
+ tabIdentifier = '#' + tabIdentifier;
+
+ this.anchors.each(function(index, anchor) {
+ var $anchor = $(anchor);
+ if ($anchor.prop('hash') === tabIdentifier) {
+ $anchor.trigger('click');
+ return false;
+ }
+ });
+ },
+
/**
* Returns the currently selected tab index.
*