diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 6b5447f45..f35d73a30 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -18,6 +18,7 @@ **Enhancements** - **Build Tools** - Added new `autoInstall` option to allow for Semantic to be installed without user interaction. See [docs explanation](http://www.semantic-ui.com/introduction/advanced-usage.html#Auto-Install) for how to use. #3616 **Thanks @algorithme** -**Site** `@px` and `@relativepx` i.e. `@relative12px` which can be used to return EM value of pixels are now extended to `@relative40px` +-**Tabs** - Added option `deactivate`, defaults to `siblings` which will only deactivate tab activators that are DOM siblings elements to the activating element. Setting it false will deactivate any other tab element initialized at the same time. -**Table** - Added more granular variablaes for controlling style on first column in a `definition table` **Docs** diff --git a/src/definitions/modules/tab.js b/src/definitions/modules/tab.js index 38fe01337..6978049fe 100644 --- a/src/definitions/modules/tab.js +++ b/src/definitions/modules/tab.js @@ -263,6 +263,9 @@ $.fn.tab = function(parameters) { }, set: { + activeTab($tab) { + + }, auto: function() { var url = (typeof settings.path == 'string') @@ -508,15 +511,19 @@ $.fn.tab = function(parameters) { }, tab: function(tabPath) { var - $tab = module.get.tabElement(tabPath), - isActive = $tab.hasClass(className.active) + $tab = module.get.tabElement(tabPath), + $deactiveTabs = (settings.deactivate == 'siblings') + ? $tab.siblings($tabs) + : $tabs.not($tab), + isActive = $tab.hasClass(className.active) ; module.verbose('Showing tab content for', $tab); if(!isActive) { $tab .addClass(className.active) - .siblings($tabs) - .removeClass(className.active + ' ' + className.loading) + ; + $deactiveTabs + .removeClass(className.active + ' ' + className.loading) ; if($tab.length > 0) { settings.onVisible.call($tab[0], tabPath); @@ -525,15 +532,19 @@ $.fn.tab = function(parameters) { }, navigation: function(tabPath) { var - $navigation = module.get.navElement(tabPath), + $navigation = module.get.navElement(tabPath), + $deactiveNavigation = (settings.deactivate == 'siblings') + ? $navigation.siblings($allModules) + : $allModules.not($navigation), isActive = $navigation.hasClass(className.active) ; module.verbose('Activating tab navigation for', $navigation, tabPath); if(!isActive) { $navigation .addClass(className.active) - .siblings($allModules) - .removeClass(className.active + ' ' + className.loading) + ; + $deactiveNavigation + .removeClass(className.active + ' ' + className.loading) ; } } @@ -840,28 +851,30 @@ $.fn.tab.settings = { verbose : false, performance : true, - auto : false, // uses pjax style endpoints fetching content from same url with remote-content headers - history : false, // use browser history - historyType : 'hash', // #/ or html5 state - path : false, // base path of url + auto : false, // uses pjax style endpoints fetching content from same url with remote-content headers + history : false, // use browser history + historyType : 'hash', // #/ or html5 state + path : false, // base path of url + + context : false, // specify a context that tabs must appear inside + childrenOnly : false, // use only tabs that are children of context + maxDepth : 25, // max depth a tab can be nested - context : false, // specify a context that tabs must appear inside - childrenOnly : false, // use only tabs that are children of context - maxDepth : 25, // max depth a tab can be nested + deactivate : 'siblings', // whether tabs should deactivate sibling menu elements or all elements initialized together - alwaysRefresh : false, // load tab content new every tab click - cache : true, // cache the content requests to pull locally - ignoreFirstLoad : false, // don't load remote content on first load + alwaysRefresh : false, // load tab content new every tab click + cache : true, // cache the content requests to pull locally + ignoreFirstLoad : false, // don't load remote content on first load - apiSettings : false, // settings for api call - evaluateScripts : 'once', // whether inline scripts should be parsed (true/false/once). Once will not re-evaluate on cached content + apiSettings : false, // settings for api call + evaluateScripts : 'once', // whether inline scripts should be parsed (true/false/once). Once will not re-evaluate on cached content onFirstLoad : function(tabPath, parameterArray, historyEvent) {}, // called first time loaded onLoad : function(tabPath, parameterArray, historyEvent) {}, // called on every load onVisible : function(tabPath, parameterArray, historyEvent) {}, // called every time tab visible onRequest : function(tabPath, parameterArray, historyEvent) {}, // called ever time a tab beings loading remote content - templates : { + templates : { determineTitle: function(tabArray) {} // returns page title for path },