Skip to content

Instantly share code, notes, and snippets.

@benubois
Last active December 12, 2015 06:08
Show Gist options
  • Save benubois/4726679 to your computer and use it in GitHub Desktop.
Save benubois/4726679 to your computer and use it in GitHub Desktop.
Select nested jquery tabs within tabs. Using a query string like ?selected_tabs=tab-3,section-tab-2. The selected tabs should be the comma separated ids of the tabs that should be active.
tabSelect: function(args) {
var queryString = greenplum.queryString();
if (typeof(queryString.selected_tabs) == 'string') {
var selectedTabs = queryString.selected_tabs.split(',');
var parentTabs = '';
for (var i=0; i < selectedTabs.length; i++) {
var index = jQuery('[href~=#' + selectedTabs[i] + ']', parentTabs).parent('li').index();
var tabs = jQuery(jQuery('#' + selectedTabs[i], parentTabs).parents('.tabs')[0]);
tabs.tabs().tabs('select', index);
var parentTabs = jQuery('#' + selectedTabs[i], parentTabs);
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment