Hi,
I am using application shell from one of PrimeBlocks, got navigation working but I can't figure out how to mark active menu item and expand it after navigation if it is a child menu item.
All pages include same template with menu.
Can someone help, is there some examples on how to achieve this?
PrimeBlocks menu
-
- Posts: 5237
- Joined: 29 Jun 2013, 12:38
Hi,
We use the following js code to active a menuitem according to router in Premium Layout. Maybe, it can help to you;
Best Regards,
We use the following js code to active a menuitem according to router in Premium Layout. Maybe, it can help to you;
Code: Select all
...
var link = this.menu.find('a[href^="' + this.cfg.pathname + '"]');
if (link.length) {
var submenu = link.next('ul');
var parentMenu = menuitem.closest('ul');
submenu.length > 0 && submenu.removeClass('hidden');
link.addClass('active-menuitem-routerlink');
if (parentMenu.length) {
while (!parentMenu.hasClass('root-menuitem')) { // a custom class for root 'ul' element
parentMenu.removeClass('hidden');
parentMenu = parentMenu.closest('ul');
if (!parentMenu.length) {
break;
}
parentMenu = parentMenu.closest('li');
}
}
...
Github Profile: https://github.com/mertsincan
-
- Information
-
Who is online
Users browsing this forum: No registered users and 1 guest