Having trouble with bootstrap4 tabs not working properly? They function well with 2 tabs using the code below:
<div class="row">
<div class="col-12">
<ul class="nav nav-tabs" id="registration-picker-acc-select" role="tablist">
<li class="nav-item">
<a class="nav-link login-link active" role="tab" data-toggle="tab" href="#form-login">
Login
</a>
</li>
<li class="nav-item">
<a class="nav-link register-link" role="tab" data-toggle="tab" href="#form-register">
Register
</a>
</li>
</ul>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="tab-content">
<div id="form-login" class="tab-pane fade show active" role="tabpanel">
{include file="inc/shared/my-account/login-form.html"}
</div>
<div id="form-register" class="tab-pane fade" role="tabpanel">
{include file="inc/shared/register/form.html"}
</div>
</div>
</div>
</div>
However, issues arise when using:
<div class="row">
<div class="col-12">
<ul class="nav nav-tabs" id="cart-picker-acc-select" role="tablist">
<li class="nav-item">
<a class="nav-link login-link active" id="form-login-top" role="tab" data-toggle="tab" href="#form-login">
Login
</a>
</li>
<li class="nav-item">
<a class="nav-link register-link" id="form-register-top" role="tab" data-toggle="tab" href="#form-register">
Register
</a>
</li>
<li class="nav-item">
<a class="nav-link continue-without-register-link" id="form-guest-top" role="tab" data-toggle="tab" href="#form-guest">
Continue without an account
</a>
</li>
</ul>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="tab-content">
<div id="form-login" class="tab-pane fade show active" role="tabpanel" aria-labelledby="form-login-top">
{include file="inc/shared/my-account/login-form.html"}
</div>
<div id="form-register" class="tab-pane fade" role="tabpanel" aria-labelledby="form-register-top">
{include file="inc/shared/register/form.html"}
</div>
<div id="form-guest" class="tab-pane fade" role="tabpanel" aria-labelledby="form-guest-top">
{include file="inc/shared/cart/step2/guest/form.html"}
</div>
</div>
</div>
</div>
After clicking on the third tab while navigating between the first two works smoothly, it starts causing disruptions:
- The
fade
classes vanish from the panels - Transitions malfunction
- The third panel might remain visible unexpectedly after switching to another one
Ran the page through the w3 validator and found no messages indicating potential id conflicts.
Note that the content within these tabs also contains their own separate tabs.