I am experiencing an issue with my HTML webpage that contains multiple BS5 Nav Tabs. The first tab is not functioning properly, while all the other tabs are working smoothly. When I click on the first BS5 Nav Tab, the page scrolls to the top with the address changing from "...../index.html" to "...../index.html#".
This problem persists in all other HTML pages that have BS5 Tabs. Only the first tab is not working as expected and is causing the page to scroll to the top. I am using Bootstrap 5 and Swiper JS.
I have attempted to resolve the issue by replacing "href" with "data-target" in the nav-items, but the problem still remains.
Below is the code snippet:
<div class="container">
<div class="m-4">
<h5>Heading</h5>
<ul class="nav nav-tabs" id="myTab1">
<li class="nav-item">
<a data-target="#tab11" class="nav-link active text-decoration-none text-dark" data-bs-toggle="tab">Tab1</a>
</li>
<li class="nav-item">
<a data-target="#tab12" class="nav-link text-decoration-none text-dark" data-bs-toggle="tab">Tab2</a>
</li>
<li class="nav-item">
<a data-target="#tab13" class="nav-link text-decoration-none text-dark" data-bs-toggle="tab">Tab3</a>
</li>
<li class="nav-item">
<a data-target="#tab14" class="nav-link text-decoration-none text-dark" data-bs-toggle="tab">Tab4</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade show active" id="tab11">
some Bootstrap Card with Swiper JS
</div>
<div class="tab-pane fade " id="tab12">
some Bootstrap Card with Swiper JS
</div>
<div class="tab-pane fade" id="tab13">
some Bootstrap Card with Swiper JS
</div>
<div class="tab-pane fade" id="tab14">
some Bootstrap Card with Swiper JS
</div>
</div>
</div>
</div>