Reputation: 67
I've tried CSS tricks to try and keep the tabs to stay appearing, but everything I click a tab - it disappears as soon as I click onto another tab.
I tried moving the JS code around and moving certain CSS attributes to the bottom of the page, beneath the tab code; nothing happens.
Could it be possible that because I have a tab on the header, that it's doing this?
the code and tabs together looks ok, no misspellings.
Upvotes: 2
Views: 2624
Reputation: 67
$(document).off('click.tab.data-api');
$(document).on('click.tab.data-api', '[data-toggle="tab"]', function (e) {
e.preventDefault();
var tab = $($(this).attr('href'));
var activate = !tab.hasClass('active');
$('div.tab-content>div.tab-pane.active').removeClass('active');
$('ul.nav.nav-tabs>li.active').removeClass('active');
if (activate) {
$(this).tab('show')
}
});
Upvotes: 2