highlight current menu entry

pull/30/head
Thorsten von Eicken 10 years ago
parent 1f8cdb66b4
commit ca0b9958c0
  1. 9
      html/ui.js

@ -246,10 +246,13 @@ onLoad(function() {
// populate menu via ajax call
var getMenu = function() {
ajaxJson("GET", "/menu", function(data) {
var html = "";
var html = "", path = window.location.pathname;
for (var i=0; i<data.menu.length; i+=2) {
html = html.concat(" <li class=\"pure-menu-item\"><a href=\"" + data.menu[i+1] +
"\" class=\"pure-menu-link\">" + data.menu[i] + "</a></li>");
var href = data.menu[i+1];
html = html.concat(" <li class=\"pure-menu-item" +
(path === href ? " pure-menu-selected" : "") + "\">" +
"<a href=\"" + href + "\" class=\"pure-menu-link\">" +
data.menu[i] + "</a></li>");
}
$("#menu-list").innerHTML = html;

Loading…
Cancel
Save