I have implemented some tabs using Bootstrap and I want to show these tabs when hovering over them.
Here is the link to view the tabs: https://jsfiddle.net/uzfxmrs3/
Below is the HTML code for the tabs:
<div class="d-flex align-items-start responsive-tab-menu">
<ul class="nav flex-column nav-pills nav-tabs-dropdown me-3" id="v-pills-tab" role="tablist"
aria-orientation="vertical">
<li class="nav-item">
<a class="nav-link text-start active" href="#" id="v-pills-home-tab" data-bs-toggle="pill"
data-bs-target="#v-pills-home" role="tab" aria-controls="v-pills-home" aria-selected="true">Home</a>
</li>
<li class="nav-item">
<a class="nav-link text-start" href="#" id="v-pills-profile-tab" data-bs-toggle="pill"
data-bs-target="#v-pills-profile" role="tab" aria-controls="v-pills-profile"
aria-selected="false">Profile</a>
</li>
</ul>
<div class="tab-content responsive-tab-content" id="v-pills-tabContent" style="border:1px solid #708090; width:600px;height:200px;">
<div class="tab-pane fade" id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab"
tabindex="0">home content</div>
<div class="tab-pane fade" id="v-pills-profile" role="tabpanel" aria-labelledby="v-pills-profile-tab"
tabindex="0">profile content</div>
</div>
</div>
Additionally, here is the jQuery code:
$('.nav-tabs-dropdown')
.on("mouseover", ".nav-link:not('.active')", function (event) {
$(this).closest('ul').removeClass("open");
})
.on("mouseover", ".nav-link.active", function (event) {
$(this).closest('ul').toggleClass("open");
});
Currently, the tabs display their content only when clicked on.