So, I want to have the same default bootstrap navbar on every page on my website. If I change the name of one page (eg: Page 1), I want to have it changed across all my pages. From what I understand, I can just use jQuery to load the header separately. However, this doesn't seem to pull the "active" class for the page which is currently active. How would I have the "active" class only on the page which is currently active.
FYI, I'm using the AngularJS framework.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Case</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">WebSiteName</a>
</div>
<div>
<ul class="nav navbar-nav">
<li class="active"><a href="">Home</a></li> <!-- Change this ".active" class-->
<li><a href="/page1">Page 1</a></li>
<li><a href="/page2">Page 2</a></li>
<li><a href="/page3">Page 3</a></li>
</ul>
</div>
</div>
</nav>
</body>
</html>
EDIT: Also, the links to the other pages would change. For example, if I were on page1, the link to home would be "../"
, link to page2 would be "../page2"
, link to itself would be ""
.