Skip to content

Commit 2619d66

Browse files
authored
Merge pull request #30 from mikejacobson/fix-disabled-toggle
Fix tab disabled toggle not working
2 parents 8ff9dfa + f3e1979 commit 2619d66

File tree

8 files changed

+36
-8
lines changed

8 files changed

+36
-8
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jquery-bootstrap-scrolling-tabs",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"main": [
55
"./dist/jquery.scrolling-tabs.js",
66
"./dist/jquery.scrolling-tabs.css"

dist/jquery.scrolling-tabs.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* jquery-bootstrap-scrolling-tabs
3-
* @version v1.2.0
3+
* @version v1.2.1
44
* @link https://github.com/mikejacobson/jquery-bootstrap-scrolling-tabs
55
* @author Mike Jacobson <michaeljjacobson1@gmail.com>
66
* @license MIT License, http://www.opensource.org/licenses/MIT

dist/jquery.scrolling-tabs.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* jquery-bootstrap-scrolling-tabs
3-
* @version v1.2.0
3+
* @version v1.2.1
44
* @link https://github.com/mikejacobson/jquery-bootstrap-scrolling-tabs
55
* @author Mike Jacobson <michaeljjacobson1@gmail.com>
66
* @license MIT License, http://www.opensource.org/licenses/MIT
@@ -1264,6 +1264,20 @@
12641264
isInitTabsRequired = true;
12651265
}
12661266

1267+
// update tab disabled state if necessary
1268+
if (origTabData[propNames.disabled] !== newTabData[propNames.disabled]) {
1269+
if (newTabData[propNames.disabled]) { // enabled -> disabled
1270+
$li.addClass('disabled');
1271+
$li.find('a[role="tab"]').attr('data-toggle', '');
1272+
} else { // disabled -> enabled
1273+
$li.removeClass('disabled');
1274+
$li.find('a[role="tab"]').attr('data-toggle', 'tab');
1275+
}
1276+
1277+
origTabData[propNames.disabled] = newTabData[propNames.disabled];
1278+
isInitTabsRequired = true;
1279+
}
1280+
12671281
// update tab active state if necessary
12681282
if (refreshData.options.forceActiveTab) {
12691283
// set the active tab based on the tabs array regardless of the current

dist/jquery.scrolling-tabs.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jquery.scrolling-tabs.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jquery-bootstrap-scrolling-tabs",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"description": "jQuery plugin for scrollable Bootstrap Tabs",
55
"homepage": "https://github.com/mikejacobson/jquery-bootstrap-scrolling-tabs",
66
"bugs": "https://github.com/mikejacobson/jquery-bootstrap-scrolling-tabs/issues",

src/js/header.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* jquery-bootstrap-scrolling-tabs
3-
* @version v1.2.0
3+
* @version v1.2.1
44
* @link https://github.com/mikejacobson/jquery-bootstrap-scrolling-tabs
55
* @author Mike Jacobson <michaeljjacobson1@gmail.com>
66
* @license MIT License, http://www.opensource.org/licenses/MIT

src/js/tabListeners.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,20 @@ function checkForTabPropertiesUpdated(refreshData) {
6262
isInitTabsRequired = true;
6363
}
6464

65+
// update tab disabled state if necessary
66+
if (origTabData[propNames.disabled] !== newTabData[propNames.disabled]) {
67+
if (newTabData[propNames.disabled]) { // enabled -> disabled
68+
$li.addClass('disabled');
69+
$li.find('a[role="tab"]').attr('data-toggle', '');
70+
} else { // disabled -> enabled
71+
$li.removeClass('disabled');
72+
$li.find('a[role="tab"]').attr('data-toggle', 'tab');
73+
}
74+
75+
origTabData[propNames.disabled] = newTabData[propNames.disabled];
76+
isInitTabsRequired = true;
77+
}
78+
6579
// update tab active state if necessary
6680
if (refreshData.options.forceActiveTab) {
6781
// set the active tab based on the tabs array regardless of the current

0 commit comments

Comments
 (0)