Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi all, I am using Umbraco v7 Razor syntax, I try to create a 3rd level sub menu, a static example here so you can get the picture. My Umbraco code:
<ul class="menuzord-menu"> @{ var maxLevelForNav = 4; var node = Umbraco.Content(1072); var home = CurrentPage.AncestorsOrSelf(1).First(); @RenderNavForNode(home, 1) foreach (var page in home.Children.Where("Visible")) { @RenderNavForNode(page, maxLevelForNav); } } @helper RenderNavForNode(dynamic page, int maxLevel) { var current = CurrentPage.Id == page.Id ? "active" : null; var node = Umbraco.Content(1072); if (page.Children.Where("Visible").Any() && page.Level == 2 ) { @:<li><a href="@page.Url" >@page.Name</a> } else { @:<li><a href="@page.Url">@page.Name</a></li> } if (page.Children.Where("Visible").Any() && page.Level < maxLevel ) { <ul class="dropdown"> @foreach (var subPage in page.Children.Where("Visible")) { @RenderNavForNode(subPage, maxLevel) } @if (item.Children.Where("Visible").Count() > 0) { foreach (var subPage in page.Children.Where("Visible")) { @:<li><a href="@subPage.Url">@subPage.Name</a></li> } } </ul> } } </ul>
I can't make the 3rd level submenu :( can you please assist? Thank you!!
Hii LD,
here ia the code for multi level menus
@{ var site = CurrentPage.Site(); if (site != null) { <ul> <li class="@(CurrentPage.Id == site.Id ? "selected" : "")"><a href="@(site.Url)">@site.Name</a></li> @traverse(site) </ul> } } @helper traverse(dynamic parent) { <ul> @foreach (IPublishedContent node in parent.Children.Where("Visible")) { <li> <a class="@(CurrentPage.Id == node.Id ? "selected" : "")" href="@node.Url">@node.Name</a> @traverse(node) </li> } </ul> }
Hope this will help you.. Cheers Sagar..!
thanks
Use the Bootstrap Megamenu
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
3rd Level submenu
Hi all, I am using Umbraco v7 Razor syntax, I try to create a 3rd level sub menu, a static example here so you can get the picture. My Umbraco code:
I can't make the 3rd level submenu :( can you please assist? Thank you!!
Hii LD,
here ia the code for multi level menus
Hope this will help you.. Cheers Sagar..!
thanks
Use the Bootstrap Megamenu
is working on a reply...