dongrouli2667 2014-05-05 07:05
浏览 40
已采纳

Bootstrap顶级下拉菜单无法正常工作

I am using bootstrap3 and have created a dropdown menu, the children of the top level are working ok but the parent is not working when I try to say click on 'About', it just shows the children and does not go to about.php

<div class="collapse navbar-collapse navbar-ex1-collapse">
            <ul class="nav navbar-nav">
                <li><a href="index.php">Home</a>
                </li>
                <li class="dropdown"><a href="about.php" data-toggle="dropdown" class="dropdown-toggle">About<b class="caret"></b></a>
                <ul class="dropdown-menu">
                   <li><a href="hours.php">Hours</a> </li>
                   <li><a href="terms.php">Terms/Conditions of Hire</a> </li>
                </ul>
                </li>
                <li><a href="location.php">Find Us</a>
                </li>
                <li><a href="services.php">Services</a>
                </li>
                <li><a href="contact.php">Contact</a>
                </li>
            </ul>
        </div>
  • 写回答

2条回答 默认 最新

  • dongyuan9292 2014-05-05 07:21
    关注

    What you are trying to do doesn't work because dropdowns are made to be clicked, and have no action but to open a menu. You can clearly see that in the examples here in the documentation

    If you made your button go to about.php when you clicked About you would never be able to open the dropdown menu to select other items.

    If you want a button you can click AND a dropdown menu you should look at adding a Split Button Dropdown (documentation here) which will give the use a clickable button, and a dropdown arrow to select more options.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 汇编语言除法溢出问题
  • ¥50 C++实现删除N个数据列表共有的元素
  • ¥15 Visual Studio问题
  • ¥15 state显示变量是字符串形式,但是仍然红色,无法引用,并显示类型不匹配
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗