Skip to content

Commit

Permalink
make current page nav-item highlighted
Browse files Browse the repository at this point in the history
  • Loading branch information
dhmlau committed Apr 17, 2020
1 parent e501770 commit 92f981e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions navbar-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</button>

<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
<ul class="nav navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="/getting-started.html">Getting Started</a>
</li>
Expand All @@ -33,4 +33,16 @@
</ul>

</div>
</nav>
</nav>
<script>
$(document).ready(function ($) {
var url = window.location.href;
var activePage = url;
$('.nav a').each(function () {
var linkPage = this.href;
if (activePage == linkPage) {
$(this).closest("li").addClass("active");
}
});
});
</script>

0 comments on commit 92f981e

Please sign in to comment.