Hi Oliver.
I have implemented this. On each menu item I have the following attribute:
ic-on-complete="updateSelectedMenuItemInHeader('#navbar-frontpage');"
The JavaScript is very simple:
function updateSelectedMenuItemInHeader(selected) {
$('#navBar').find('a.active').removeClass('active');
$(selected).addClass('active');
}
If you use "ic-push-url='true'" then you need to also handle the "Back" button. Like:
$(window).on('popstate', function (event) {
updateSelectedMenuItemOnBackButton(event);
});
function updateSelectedMenuItemOnBackButton(event) {
if (typeof Storage === "undefined") return;
var stateData = event.originalEvent.state;
if (stateData === null) return;
var historyData = JSON.parse(localStorage.getItem(stateData['ic-id']));
if (historyData === null) return;
// Home
if (historyData.url === '/xyz' || historyData.url === '/xyz/') {
updateSelectedMenuItemInHeader('#navbar-frontpage');
return;
}
....
}
I hope this helps.