Skip to content

Instantly share code, notes, and snippets.

@quevon24
Forked from daverogers/footer.js
Created October 22, 2017 03:10
Show Gist options
  • Save quevon24/c44283c94ebca0d9a68057c68aabb661 to your computer and use it in GitHub Desktop.
Save quevon24/c44283c94ebca0d9a68057c68aabb661 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