I am currently working with a detailed structure of bootstrap theme classes.
Currently, I am in the process of designing a menu.
This is the code snippet for the navigation bar design in Bootstrap-
<div class="navbar navbar-fixed-top navbar-inverse">
<div class="navbar-inner">
<div class="container-fluid">
<a class="btn btn-navbar" data-toggle="collapse"
data-target=".nav-collapse"><span
class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>
</a><a class="brand" href="#">My Menu</a>
<div class="nav-collapse">
<ul class="nav">
<li class="active"><a href="/Home/Dashboard"><i class="icon-home icon-white"></i>Dashboard</a></li>
<li ><a href="#" id="taskMainLink">Task</a></li>
<li><a href="#" id="contactMainLink">Contact</a></li>
<li><a href="#" id="appointmentMainLink">Appointment</a></li>
<li><a href="#" id="projectMainLink">Project</a></li>
<li><a href="#" id="salesMainLink">Sales</a></li>
</ul>
Issue at Hand
I am aiming to make each tab active upon mouse click while keeping the other tabs in their original state. Currently, the dashboard tab is set as active by default.
The Approach I'm Following Every Time a Tab is Clicked-
$('.navbar.navbar-fixed-top.navbar-inverse>.container-fluid>.nav-collapse>.nav').click(function(){
$(this).find('li').removeClass('active');
$(this).addClass('active');
});
Am I applying the correct classes? Any suggestions for a better solution if I'm mistaken?