Created
November 12, 2015 05:22
-
-
Save kohki-shikata/6859ee7e2718c4e254c6 to your computer and use it in GitHub Desktop.
jQuery add class current page navigation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add class current page navigation | |
$(document).ready(function() { | |
var url = location.pathname; | |
if(location.pathname != "/") { | |
$('nav.subpage_sidebar a[href^="' + location.pathname + '"]').parent().addClass('active'); | |
} else $('nav.subpage_sidebar a:eq(0)').parent().addClass('active'); | |
//console.log(url); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment