openam / bootstrap-responsive-tabs

Bootstrap responsive tabs are tabs that switch to collapsible components (accordions) when resized.
openam.github.io/bootstrap-responsive-tabs
MIT License
132 stars 60 forks source link

Weird behavour on first click. #32

Closed rope-hmg closed 8 years ago

rope-hmg commented 9 years ago

Clicking any of the tabs for the first time would show the new tab and then instantly return to the default tab. ( the one initially set with .active class ).

After some investigation I changed

var current = $( e.target ).context.id.replace( /collapse-/g, "#" );

to

var current = $( e.target ).context.id.replace( /#collapse-/g, "#" );

which seems to have solved to problem.

located at aprox. line 165

fakewaffle.bindTabToCollapse = function() {
 ...
 collapse.on( "shown.bs.collapse", function( e ) {
  ...
  var current = $( e.target ).context.id.replace( /#collapse-/g, "#" );
  ...
 }
 ...
}

I don't know if anyone else was having this issue, but I hope this helps.

openam commented 9 years ago

Was there something besides the first tab set as the .active tab? Was it happening to you on the demo page? Did you have multiple tab sets? I'm guessing this is on the Bootstrap 3.0 version since it's the one with var current = $( e.target ).....

rope-hmg commented 9 years ago

Only the first tab was set to .active and there was only one tab set on the page. Yes it is the Bootstrap 3.0 version. I didn't actually check the demo page, but I was using Chromium Version 41.0.2272.76 Ubuntu 14.10 (64-bit) in case that helps.

openam commented 8 years ago

Closing due to inactivity.

Also it doesn't make sense that any if the ids would start with a #.