I have made a navigational bar in Bootstrap.
It is in a file called header.html
.
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav pull-right">
<li class="item active"><a href="./index.shtml">Home</a></li>
<li><a href="./courses.shtml">Courses</a></li>
<li><a href="./projects.shtml">Projects</a></li>
<li><a href="./publications.shtml">Publications</a></li>
<li><a href="./patents.shtml">Patents</a></li>
</ul>
I use an include virtual
on all 5 pages on the navbar to display my menu bar.
<!--#include virtual="/templates/header.html" -->
I am trying to figure out a way to apply the "item active" class to the page that the browser is viewing, all while using an included header file.
The only solution I thought of would be creating a CSS sheet per page, and only loading that specific CSS sheet depending on the page loaded.
That specific CSS sheet would style that specific li
item.
I am open to using JavaScript if needed.