twitter-bootstrap-wizard icon indicating copy to clipboard operation
twitter-bootstrap-wizard copied to clipboard

onTabShow event fires twice

Open mikheil09 opened this issue 10 years ago • 8 comments

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; } });

mikheil09 avatar Jan 08 '15 12:01 mikheil09

+1 having the same issue.

loriolson avatar Aug 11 '16 16:08 loriolson

+1 @stefann42 commit fixes the issue.

nask0 avatar Oct 24 '16 11:10 nask0

Please can anyone tell me the solution for this issue? I am facing the same in my project. Urgent.

a3aakash avatar Nov 24 '16 13:11 a3aakash

@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.

nask0 avatar Nov 24 '16 15:11 nask0

thank you @nask0.. I think this is not being released on the master branch thats why my code was not updated. Thanks again.. :)

a3aakash avatar Nov 25 '16 06:11 a3aakash

This issue hasnt been uploaded on the master branch till yet. so please do this so that it wont create any issue further.

a3aakash avatar May 31 '17 12:05 a3aakash

@mikheil09 @nask0 @a3aakash can you submit a pull request?

VinceG avatar May 31 '17 14:05 VinceG

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.

sebastianvirlan avatar Feb 14 '18 22:02 sebastianvirlan