twitter-bootstrap-wizard
twitter-bootstrap-wizard copied to clipboard
onTabShow event fires twice
When I call bootstrap wizard and try handle 'onTabShow' event, it fires two time
my code is: var wizardEl = $('#rootwizard'); wizardEl.bootstrapWizard({ onTabShow: function (tab, navigation, index) { var $total = navigation.find('li').length; var $current = index + 1; var $percent = ($current / $total) * 100; wizardEl.find('.progress-bar').css({ width: $percent + '%' }); lastPageIndex = $total; loadWizardCurrentStepContent(tab, $current); }, onNext: wizardOnNext, onTabClick: function (tab, navigation, index) { return true; } });
+1 having the same issue.
+1 @stefann42 commit fixes the issue.
Please can anyone tell me the solution for this issue? I am facing the same in my project. Urgent.
@a3aakash just read the whole issue, solution is here : https://github.com/AreYouFreeBusy/twitter-bootstrap-wizard/commit/98e392746a14645ed4ff3ada31cd923e864273c6 - i already tested it and it works. However, i just make small tunes on @stefann42 code.
thank you @nask0.. I think this is not being released on the master branch thats why my code was not updated. Thanks again.. :)
This issue hasnt been uploaded on the master branch till yet. so please do this so that it wont create any issue further.
@mikheil09 @nask0 @a3aakash can you submit a pull request?
This is not an issue. This behaviour happens when you don't have any default active
class on any of the tab's li
.
When the library is initialised fixNavigationButtons
from line 31 is called. But because you don't have an active tab the 275 line event is triggered which again trigger fixNavigationButtons
275: $('a[data-toggle="tab"]', $navigation).on('show show.bs.tab', innerTabShown);
As https://getbootstrap.com/docs/3.3/components/#nav-tabs tabs documentation example is:
<ul class="nav nav-pills">
<li role="presentation" class="active"><a href="#">Home</a></li>
<li role="presentation"><a href="#">Profile</a></li>
<li role="presentation"><a href="#">Messages</a></li>
</ul>
there is a default tab.