forked from IllinoisRef/mechref
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnav.html
35 lines (34 loc) · 1.01 KB
/
nav.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<div class="navbar">
<ul id="navItems">
<li class="active"><a href="/index.html" id="navHome">Home</a></li>
<li><a href="/sta/ref.html" id="navStaRef">Statics References</a>
</li>
<li><a href="/dyn/ref.html" id="navDynRef">Dynamics References</a>
</li>
<li><a href="/sol/ref.html" id="navSolRef">Solids References</a>
</li>
<li><a href="/pol/index.html" id="navPolIdx">TAM 2XX</a>
</li>
</ul>
<script>
$(function(){
var current = location.pathname;
// if(window.location.href.indexOf("DynamicsBook") > -1){
// $this.parent().parent().parent().parent().parent().addClass('active');
// console.log("Make references active")
// }
if (current != "/"){
$('#navItems li a').each(function(){
var $this = $(this);
// if the current path is like this link, make it active
if($this.attr('href').indexOf(current) !== -1){
$this.parent().addClass('active');
}
else {
$this.parent().removeClass('active');
}
})
}
})
</script>
</div>