Skip to content

Instantly share code, notes, and snippets.

Created February 17, 2014 05:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/9173400fc74f73fb22dd to your computer and use it in GitHub Desktop.
Save anonymous/9173400fc74f73fb22dd to your computer and use it in GitHub Desktop.
var page = document.location.pathname.match(/[^\/]+$/)[0];
$(document).ready(function(){
var ul = $('nav > ul'),
li = ul.children('li'),
href = li.find('a[href*="'+page+'"]');
ul.prepend(href.parent());
//move element to top
if (page !== '') {
li.children('a').each(function(){
if (page != this.attr('href')) {
ul.prepend("<li><a href='404NotFound.php'>404</a></li>");
}
})
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment