I am using github to host a static site and Jekyll to generate it.
I have a menu bar (as ) and would like the correspo
I used a little bit of JavaScript to accomplish this. I have the following structure in the menu:
This javascript snippet highlights the current corresponding page:
$(document).ready(function() {
var pathname = window.location.pathname;
$("#navlist a").each(function(index) {
if (pathname.toUpperCase().indexOf($(this).text().toUpperCase()) != -1)
$(this).addClass("current");
});
if ($("a.current").length == 0)
$("a#index").addClass("current");
});