I mean highlight a specific menu item when i enter directly an url to my application.
I was using this code (suggested from aragorn) which no longer works with Ultima 3.0.0 and PF X:
Code: Select all
$(document).ready(function () {
var $this = PF('sidebar-menu');
if ($this) {
var pathname = window.location.pathname;
$this.expandedMenuitems = [];
$this.clearMenuState();
if (pathname.indexOf('.xhtml') > 0) {
var activeLink = $this.menulinks.filter('[href^="' + pathname + '"]');
var item = activeLink.parent('li');
var menuId = item.attr('id');
if (jQuery.inArray(menuId, $this.expandedMenuitems) !== 0) {
$this.addMenuitem(menuId);
addParentItems($this, item);
}
}
trackmenu();
}
});
function addParentItems($this, item) {
if (item && item.length) {
var parent = item.parents('li:first');
$this.addMenuitem(parent.attr('id'));
if (!parent.parent('ul').hasClass('ultima-menu')) {
addParentItems($this, parent);
} else {
return;
}
}
return;
}
Thanks