Skip to content
This repository
Browse code

tabset activateTab handles -1 for no selection

  • Loading branch information...
commit b655311cac5a304d66906924c6027e6489402e3f 1 parent 994b797
Jack Carrig jcarrig authored

Showing 1 changed file with 14 additions and 11 deletions. Show diff stats Hide diff stats

  1. +14 11 src/js/tab_set.js
25 src/js/tab_set.js
@@ -68,7 +68,8 @@
68 68
69 69 activateTab : function(index) {
70 70
71   - $(this.el).removeClass('no_selection');
  71 + var noSelection = index < 0;
  72 + $(this.el).toggleClass('no_selection', noSelection);
72 73
73 74 // hide all content panels
74 75 _(this._contents).each(function(content) {
@@ -83,16 +84,18 @@
83 84 if(_(this._selectedIndex).exists()) {
84 85 $(this.el).removeClass('index_' + this._selectedIndex);
85 86 }
86   - $(this.el).addClass('index_' + index);
87   - this._selectedIndex = index;
88   -
89   - // select the appropriate tab
90   - $(this._tabs[index]).addClass('selected');
91   -
92   - // show the proper contents
93   - $(this._contents[index]).show();
94   -
95   - this._callbacks[index]();
  87 +
  88 + if(!noSelection){
  89 + $(this.el).addClass('index_' + index);
  90 + this._selectedIndex = index;
  91 + // select the appropriate tab
  92 + $(this._tabs[index]).addClass('selected');
  93 + // show the proper contents
  94 + $(this._contents[index]).show();
  95 + this._callbacks[index]();
  96 + }else{
  97 + this._selectedIndex = null;
  98 + }
96 99 },
97 100
98 101 // returns the index of the selectedTab

0 comments on commit b655311

Please sign in to comment.
Something went wrong with that request. Please try again.