That's right, a bit of a long answer, but carrying with me - there are two problems that need to be “fixed” in order to make this work ...
First problem: the first two tabs are displayed simultaneously.
Reason : lines of boostrap.css (not reduced) 4042 and 4047 select only immediate descendants of the div:
.tab-content > .tab-pane
and
.tab-content > .active
Permission . Add the following CSS to a separate CSS file:
.tab-content .tab-pane { display: none; } .tab-content .active { display: block; }
The second problem: the third tab is now always displayed when it was pressed, and another tab is selected.
Reason . This is because when boostrap clears the “active” class from tabs that have not been pressed, it searches only for direct children of the container. On line 1563 of the bootstrap.js file:
var $active = container.find('> .active')
Permission . To fix this, you need to change this line to:
var $active = container.find('.active')
However, this is not ideal. Therefore, if you do not want to change the boot code, you can ...
- Copy all elements of the boot tab between lines 1510 and 1624
- Rename all occurrences of
Tab to NewTab - Change
$.fn.tab from line 1602 to $.fn.modifiedTab or similar - Change
(data = new Tab(this)) on line 1606 to (data = new NewTab(this)) - Use it as documentation , but
.tab becomes .modifiedTab
Hope that helps :)
source share