The tabs on this page should not be "active", but they are. If you click on one of the tabs it takes you to it's page and is given the "active" class correctly. Also, I can't get the image below the tabs to come in on subsiquent pages. Any help would be appreciated!
@inherits umbraco.MacroEngines.DynamicNodeContext
@{
var home = Model.AncestorOrSelf(2);
var nav = home.Children.Where("Visible");
<ul>
@foreach(var item in nav){
var style = item.IsDescendantOrSelf(Model) ? "class=active" : "";
<li @style ><a href="@item.Url"><span>@item.Name</span></a>
@* test to see if there are child nodes and if so make the dropdown list *@
@if(item.Children.Count() > 0){
<ul>
@foreach(var subNav in item.Children){
var first = subNav.IsFirst() ? "class=first" : "";
<li @first ><a href="@subNav.Url"><span>@subNav.Name</span></a></li>
}
</ul>
}
</li>
}
</ul>
@* test to see if property useAlternateNavigation is checked if not load the image below the tabs *@
if(Model.HasValue("useAlternateNavigation")){
<img src="/static/phase2/tabNavBorderBottom.jpg" class="tabBorder" />
}
}
The problem I have is that on the main page, I don't want any of the tabs which are children of @Model (current page), but once I get to one of the child pages I do want the children of @Model (current page) to have the "active" class. This is the part that is tripping me up:
@{
var home = Model.AncestorOrSelf(2);
var nav = home.Children.Where("Visible");
<ul>
@foreach(var item in nav){
var style = item.IsDescendantOrSelf(Model) ? "class=active" : "";
<li @style ><a href="@item.Url"><span>@item.Name</span></a>
Dropdown navigation Help
I've almost got it to work correctly, but I am haveing problems assigning a "current" class to the correct parts of my navigation. Here is my site: https://edit-wwwprep.rose-hulman.edu/student-life.aspx
The tabs on this page should not be "active", but they are. If you click on one of the tabs it takes you to it's page and is given the "active" class correctly. Also, I can't get the image below the tabs to come in on subsiquent pages. Any help would be appreciated!
Steve,
Here is a sample of my navigation code so hopefully it provides some assistance.
The magic where it happens is:
The problem I have is that on the main page, I don't want any of the tabs which are children of @Model (current page), but once I get to one of the child pages I do want the children of @Model (current page) to have the "active" class. This is the part that is tripping me up:
is working on a reply...