I'm breaking my head on some little thing that i need to put in my code, i just need to add a class to the H3 and the DIV element, when the children of that element has a class Active - Or add a class to the parent of these children. for now i have the class Active to the LI active element added but i can't get it done for the above laying elements.
Umbraco version: 4.9.0
@using umbraco.MacroEngines;
@{
var count = 0;
var startLevel = 2;
var finishLevel = 3;
var parent = @Model.AncestorOrSelf(startLevel);
int children = 0;
}
@ulMenu(parent, startLevel, finishLevel)
@helper ulMenu(dynamic parent, int startLevel, int finishLevel)
{
var children = @parent.Children.Count();
@foreach (var node in parent.Children)
{
var Class = (@node.Id.Equals(@Model.Id)) ? "active" : String.Empty;
var Aclass = @node.menuSubText.GetType() == typeof(DynamicNull) ? "navigation" : "navigation";
var itemName = Library.Truncate(@node.Name, 20, true);
if (@node.Children.Count() > 0)
{
if (@node.hideInNavigation == false)
{
if (node.HasAccess)
{
Add class to parent node
Hi,
I'm breaking my head on some little thing that i need to put in my code, i just need to add a class to the H3 and the DIV element, when the children of that element has a class Active - Or add a class to the parent of these children. for now i have the class Active to the LI active element added but i can't get it done for the above laying elements.
Umbraco version: 4.9.0
@using umbraco.MacroEngines; @{ var count = 0; var startLevel = 2; var finishLevel = 3; var parent = @Model.AncestorOrSelf(startLevel); int children = 0; } @ulMenu(parent, startLevel, finishLevel) @helper ulMenu(dynamic parent, int startLevel, int finishLevel) { var children = @parent.Children.Count();
@foreach (var node in parent.Children)
{
var Class = (@node.Id.Equals(@Model.Id)) ? "active" : String.Empty;
var Aclass = @node.menuSubText.GetType() == typeof(DynamicNull) ? "navigation" : "navigation";
var itemName = Library.Truncate(@node.Name, 20, true);
if (@node.Children.Count() > 0)
{
if (@node.hideInNavigation == false)
{
if (node.HasAccess)
{
@if (@node.Level <= finishLevel && node.Name.ToLower() != "nieuws")
{
@ulMenu(node, startLevel, finishLevel)
}
}
}
}
else
{
if (@node.hideInNavigation == false)
{
if (node.HasAccess)
{
-
@itemName
@if (@node.Level.Equals(2) && !(@node.menuSubText.GetType() == typeof(DynamicNull)))
{
@node.GetProperty("menuSubText").Value
}
}
}
}
}
}@itemName @if (@node.Level.Equals(2) && !(@node.menuSubText.GetType() == typeof(DynamicNull))) { @node.GetProperty("menuSubText").Value }
Greetz Pieter
nobody :( ?
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.