Twitter bootstrap 3 Bootstrap 3变量菜单断点

Twitter bootstrap 3 Bootstrap 3变量菜单断点,twitter-bootstrap-3,breakpoints,navbar,collapse,Twitter Bootstrap 3,Breakpoints,Navbar,Collapse,使用Bootstrap3,我有一个看起来很常见的情况。我的菜单取决于谁登录,如下所示: <!-- Starts with vanilla Bootstrap navbar classes --> <div class="navbar navbar-inverse navbar-fixed-top" role="navigation"> <div class="container"> <div class="navbar-heade

使用Bootstrap3,我有一个看起来很常见的情况。我的菜单取决于谁登录,如下所示:

<!-- Starts with vanilla Bootstrap navbar classes -->
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" 
                   data-toggle="collapse" data-target=".navbar-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">Brand</a>
        </div>
        <!-- This is the variable sized menu that gets generated -->
        <!--   by the server depending on the user's role.  I've -->
        <!--   cut it down to two roles for simplicity but there -->
        <!--   will be four roles that each contain various menu -->
        <!--   items.                                            -->
        <div class="navbar-collapse collapse">
            <ul class="nav navbar-nav">
                @if (Request.IsAuthenticated)
                {
                    if (User.IsInRole("PowerUser"))
                    {
                        <li>@Html.ActionLink("Home", "Index", "Home")</li>
                        <li>@Html.ActionLink("Browse", "Browse", "Browser")</li>
                        <li>@Html.ActionLink("Manage", "Manage", "Manager")</li>
                        <li>@Html.ActionLink("Upload", "Upload", "Uploader")</li>
                        <li>@Html.ActionLink("About", "About", "Home")</li>
                        <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
                    } // elseif User.IsInRole: Member, Administrator, etc.
                }
                else
                {
                    <li>@Html.ActionLink("Home", "Index", "Home")</li>
                    <li>@Html.ActionLink("About", "About", "Home")</li>
                    <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
                }
            </ul>
            <!-- Now on the right side of the menu we have registration/login -->
            <!-- This wraps (not collapses!) when logged in as PowerUser and -->
            <!--   with the breakpoint set at 1000px in variables.less -->
            <!-- This collapses perfectly with the user not logged in (i.e. guest) -->
            <ul class="nav navbar-nav navbar-right">
                <li class="@ActiveItem("Register", "Account", null)">
                    @Html.ActionLink("Register", "Register", "Account", 
                        new { ReturnUrl = this.Request.Url.AbsolutePath }, 
                        new { id = "registerLink", 
                              data_dialog_title = "Registration" })
                </li>
                <li class="@ActiveItem("Login", "Account", null)">
                    @Html.ActionLink("Login", "Login", "Account", 
                        new { ReturnUrl = this.Request.Url.AbsolutePath }, 
                        new { id = "loginLink", 
                              data_dialog_title = "Identification" })
                </li>
            </ul>
        </div>
        <!-- .nav-collapse -->
    </div>
</div>

切换导航
    @如果(请求已验证) { if(User.IsInRole(“PowerUser”)) {
  • @ActionLink(“主页”、“索引”、“主页”)
  • @ActionLink(“浏览”、“浏览”、“浏览”)
  • @ActionLink(“管理”、“管理”、“管理者”)
  • @ActionLink(“上传”、“上传”、“上传者”)
  • @ActionLink(“关于”、“关于”、“主页”)
  • @ActionLink(“联系人”、“联系人”、“主页”)
  • }//elseif User.IsInRole:成员、管理员等。 } 其他的 {
  • @ActionLink(“主页”、“索引”、“主页”)
  • @ActionLink(“关于”、“关于”、“主页”)
  • @ActionLink(“联系人”、“联系人”、“主页”)
  • }
  • @ActionLink(“注册”、“注册”、“帐户”, 新建{ReturnUrl=this.Request.Url.AbsolutePath}, 新建{id=“registerLink”, 数据对话框(标题=“注册”})
  • @ActionLink(“登录”、“登录”、“帐户”, 新建{ReturnUrl=this.Request.Url.AbsolutePath}, 新建{id=“loginLink”, 数据对话框(标题=“标识”})
通过使用@grid float breakpoint value,我成功地静态更改了断点(折叠点)。但是,我无法根据用户的角色来决定如何动态地这样做。我知道,在服务器上,谁登录了,但是除了链接引导CSS的不同预编译版本之外,我似乎想不出一种方法来控制不同菜单宽度的断点宽度


有什么建议吗?

请添加一些代码来支持您的问题。我用一些代码和简化更改了我的问题。