Reputation: 69
Can anyone help with this question, I'm trying to create a sub menu to show up when I hover over the top navigation in Umbraco.
Heres the code I'm using to create the top navigation, what do I need to add so I can display a sub menu?
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{ var selection = CurrentPage.Site().Children.Where("Visible"); }
<ul class="nav navbar-nav">
@foreach (var item in selection)
{
<li class="@(item.IsAncestorOrSelf(CurrentPage) ? "current" : null)">
<a href="@item.Url">@item.Name</a>
</li>
}
</ul>
Upvotes: 0
Views: 1043
Reputation: 4257
Just add a nested UL inside your current one to list the children of each the top level pages, using the same code as you're using for the top level stuff. You can then use whatever front end dropdown menu code you like to get the hovering to work.
Upvotes: 1