Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • strawberrylatte 28 posts 96 karma points
    Mar 02, 2021 @ 05:29
    strawberrylatte
    0

    set link as static if doc type has no template

    I am very new to umbraco and I wanted to make the parent of my submenus to be static (#) if the doctype used has no template, so far these are what I have done.

                                        if (root != null)
                                        {
                                            foreach (var child in root.Children)
                                            {
                                                <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-5818 @(Model.Url == child.Url ? "current-menu-item" : null)" style="display: flex; justify-content: space-between">
                                                    <a href="@child.Url">@child.Name</a>
                                                    @if (child.Children.Any() && !child.IsDocumentType("people"))
                                                    {
                                                        <button href="#" onclick="toggleChildMenu('[email protected]', this)" style="cursor: pointer; background: none; border: none; padding: 0 1rem; font-size: 1rem; color: rgb(140, 140, 140)">
                                                            <i class="fa fa-chevron-down" aria-hidden="true"></i>
                                                        </button>
                                                    }
                                                </li>
                                                if (child.Children.Any() && !child.IsDocumentType("people")) // don't show child nodes of people
                                                {
                                                    <li id="[email protected]" style="border: none; display: none;">
                                                        <ul style="margin-left: 1rem; margin-bottom: 0;" class="gdlr-core-custom-menu-widget gdlr-core-menu-style-list">
                                                            @foreach (var child2 in child.Children)
                                                            {
                                                                <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-5818 @(Model.Url == child2.Url ? "current-menu-item" : null)">
                                                                    <a href="@child2.Url">@child2.Name</a>
                                                                </li>
                                                            }
                                                        </ul>
                                                    </li>
                                                }
                                            }
                                        }
                                    }
    
  • 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.

Please Sign in or register to post replies