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 // populate menu via ajax call
var getMenu = function() { var getMenu = function() {
ajaxJson("GET", "/menu", function(data) { ajaxJson("GET", "/menu", function(data) {
var html = ""; var html = "", path = window.location.pathname;
for (var i=0; i<data.menu.length; i+=2) { for (var i=0; i<data.menu.length; i+=2) {
html = html.concat(" <li class=\"pure-menu-item\"><a href=\"" + data.menu[i+1] + var href = data.menu[i+1];
"\" class=\"pure-menu-link\">" + data.menu[i] + "</a></li>"); 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; $("#menu-list").innerHTML = html;

Loading…
Cancel
Save