本文介绍了无法展开导航栏下拉菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个包含下拉菜单的导航栏.当我单击标题时,根本没有任何反应.

这是我的代码:

<div class="container-fluid"><div class="navbar-header"><a class="navbar-brand icon-github" href="/"></a>

<div class="collapse navbar-collapse"><ul class="nav navbar-nav">

  • <a href="#" class="dropdown-toggle" data-toogle="dropdown" role="button" aria-expanded="false">顾客<span class="caret"></span></a><ul class="dropdown-menu" role="menu"><li><a href="/Customers">所有客户</a></li><li><<a href="/Customers/Recent">最近添加</a></li><li><a href="/Customers/AppointmentsToday">今天的约会</a></li><li class="divider"></li><li><a href="/Customers/Create">创建新客户</a></li>
  • </nav>

    控制台没有错误.

    解决方案

    这是一个简单的错字:您使用的是 data-toogle 而不是 data-toggle.它应该适用于此:

    顾客<span class="caret"></span></a>

    I have created a navbar containing a dropdown menu. When i click header, simply nothing happens.

    Here is my code:

    <nav class="navbar navbar-default navbar-fixed-top">
        <div class="container-fluid">
            <div class="navbar-header">
                <a class="navbar-brand icon-github" href="/"> </a>
            </div>
            <div class="collapse navbar-collapse">
                <ul class="nav navbar-nav">
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toogle="dropdown" role="button" aria-expanded="false">
                            Customers
                        <span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu" role="menu">
                            <li><a href="/Customers">All Customers</a></li>
                            <li><<a href="/Customers/Recent">Recently added</a></li>
                            <li><a href="/Customers/AppointmentsToday">Today's appointments</a></li>
                            <li class="divider"></li>
                            <li><a href="/Customers/Create">Create new customer</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </nav>
    

    There is no error in the console.

    解决方案

    It's a simple typo: You have data-toogle instead of data-toggle.It should work with this:

    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
        Customers
    <span class="caret"></span>
    </a>
    

    这篇关于无法展开导航栏下拉菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!