Skip to content

Instantly share code, notes, and snippets.

@e0ne
Created February 3, 2013 00:29
Show Gist options
  • Save e0ne/4699909 to your computer and use it in GitHub Desktop.
Save e0ne/4699909 to your computer and use it in GitHub Desktop.
Set active class for menu link of the current page
$(document).ready(function(){
var desiredMenuItem = document.location.hash.replace("#", "") || 'home';
$(".nav a[rel=" + desiredMenuItem + "]").parent().addClass("active");
})s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment