Skip to content

Instantly share code, notes, and snippets.

/obama.js Secret

Created February 17, 2014 06:13
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/8a6f7889f88a72c5225d to your computer and use it in GitHub Desktop.
Save anonymous/8a6f7889f88a72c5225d to your computer and use it in GitHub Desktop.
var is_mobile = false,
page = document.location.pathname.match(/[^\/]+$/)[0];
$(document).ready(function(){
var ul = $('nav > ul'),
li = ul.children('li'),
href = li.find('a[href*="'+page+'"]'),
is404 = true;
if($('#mobile').css('display')=='none') {
is_mobile = true;
}
//alert(li.children('a').attr('href'));
if(is_mobile) {
$(li.find('a[href*="contact.php"]')).removeAttr('style');
//jQuery.makeArray(li.children('a').attr('href'));
//move element to top
ul.prepend(href.parent());
if(page != ""){
li.children('a').each(function(){
if (page == this.attr('href')) {
is404 = false;
}
});
if (is404) {
ul.prepend("<li><a href='404NotFound.php'><icon><img src='images/home-icon.png'></icon>404</a></li>");
}
}
prepareList();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment