Skip to content

Instantly share code, notes, and snippets.

@WinSCaP
Forked from daverogers/footer.js
Created July 3, 2018 08:16
Show Gist options
  • Save WinSCaP/d312fdbc3f6fdb26137f10abfe8b9a28 to your computer and use it in GitHub Desktop.
Save WinSCaP/d312fdbc3f6fdb26137f10abfe8b9a28 to your computer and use it in GitHub Desktop.
Assign "active" class to navbar item based on current page URL with jQuery
<!-- your average Bootstrap navbar component, in this case placed in an include called header.html -->
<div class="navbar">
<div class="navbar-inner">
<ul class="nav">
<li><a href="/">Home</a></li>
<li><a href="/about.php">About</a></li>
<li><a href="/contact.php">Contact</a></li>
</ul>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment