Skip to content
This repository has been archived by the owner on Aug 6, 2019. It is now read-only.

Commit

Permalink
fix of issue 167
Browse files Browse the repository at this point in the history
The "shown" event will be fired after the tab has already displayed, so all false return values will be ignored, causing #167 (e.g. a click on a disabled tab will still show it): The fix is to indeed use the show instead of the shown event.
  • Loading branch information
jstaerk committed Feb 8, 2016
1 parent ec709e7 commit 4c29fb5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions jquery.bootstrap.wizard.js
Expand Up @@ -228,7 +228,7 @@ var bootstrapWizardCreate = function(element, options) {
}
};

var innerTabShown = function (e) { // use shown instead of show to help prevent double firing
var innerTabShown = function (e) {
var $element = $(e.target).parent();
var nextTab = $navigation.find(baseItemSelector).index($element);

Expand All @@ -249,15 +249,15 @@ var bootstrapWizardCreate = function(element, options) {

// remove the existing handlers
$('a[data-toggle="tab"]', $navigation).off('click', innerTabClick);
$('a[data-toggle="tab"]', $navigation).off('shown shown.bs.tab', innerTabShown);
$('a[data-toggle="tab"]', $navigation).off('show show.bs.tab', innerTabShown);

// reset elements based on current state of the DOM
$navigation = element.find('ul:first', element);
$activeTab = $navigation.find(baseItemSelector + '.active', element);

// re-add handlers
$('a[data-toggle="tab"]', $navigation).on('click', innerTabClick);
$('a[data-toggle="tab"]', $navigation).on('shown shown.bs.tab', innerTabShown);
$('a[data-toggle="tab"]', $navigation).on('show show.bs.tab', innerTabShown);

obj.fixNavigationButtons();
};
Expand All @@ -281,8 +281,8 @@ var bootstrapWizardCreate = function(element, options) {

$('a[data-toggle="tab"]', $navigation).on('click', innerTabClick);

// attach to both shown and shown.bs.tab to support Bootstrap versions 2.3.2 and 3.0.0
$('a[data-toggle="tab"]', $navigation).on('shown shown.bs.tab', innerTabShown);
// attach to both show and show.bs.tab to support Bootstrap versions 2.3.2 and 3.0.0
$('a[data-toggle="tab"]', $navigation).on('show show.bs.tab', innerTabShown);
};
$.fn.bootstrapWizard = function(options) {
//expose methods
Expand Down

0 comments on commit 4c29fb5

Please sign in to comment.