Skip to content

Instantly share code, notes, and snippets.

@birkmarcus
Created September 18, 2014 17:00
Show Gist options
  • Save birkmarcus/a5c20d0eede7e926ef44 to your computer and use it in GitHub Desktop.
Save birkmarcus/a5c20d0eede7e926ef44 to your computer and use it in GitHub Desktop.
Style current Link active
function setSelectedPageNav() {
var pathName = document.location.pathname;
if ($("nav ul li a") != null) {
var currentLink = $("nav ul li a[href='" + pathName + "']");
currentLink.addClass("active");
}
}
setSelectedPageNav();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment