Copied to clipboard

Flag this post as spam?

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


  • mikkel 143 posts 365 karma points
    Mar 16, 2019 @ 13:03
    mikkel
    0

    Why Can i not use the burger menu as a main menu

    Hi every one How can I use the burger menu as a menu if there are over 7 navbar items in the menu.

    Here is what i am trying to do

     @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @{
        var selection = Model.Content.Site().Children()
                            .Where(x => x.IsVisible());
    }
    @if (selection.Count() <= 5)
    {
        <ul class="navbar-nav ml-auto">
            @foreach (var item in selection)
            {
                <li class="nav-item">
                    <a href="@item.Url">@item.Name</a>
                </li>
            }
        </ul>
    }
    else
    {
        <link href="~/css/test.css" rel="stylesheet" />
        <div id="DontShowNav" class="pull-left">
            <div class="dropdown">
                @*<a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="" aria-haspopup="true" aria-expanded="false">
                        Menu
                    </a>*@
                <button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
                    <i class="fas fa-bars"></i>
                    Menu
                </button>
                <div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
                    @foreach (var item in selection)
                    {
    
                        <a href="@item.Url" class="dropdown-item">@item.Name</a>
    
                    }
                </div>
            </div>
        </div>
    
    }
    
  • Harry Spyrou 212 posts 604 karma points
    Mar 18, 2019 @ 10:35
    Harry Spyrou
    1

    It will never allow you to have more than 5 items because you're telling it

    @if (selection.Count() <= 5)
    
  • 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