Skip to content

Instantly share code, notes, and snippets.

@jblac
Created January 31, 2013 21:22
Show Gist options
  • Save jblac/4686575 to your computer and use it in GitHub Desktop.
Save jblac/4686575 to your computer and use it in GitHub Desktop.
var loc = location.pathname.replace(/\/([^.]+)\//g,'');
var current = $nav.find('a[href="'+loc+'"]');
if(current.parent().parent().is('#nav')){
current.addClass('active');
}else{
current.parent().parent().parent().find('a').eq(0).addClass('active').next().show();
current.addClass('active');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment