使用特定模板时添加下拉引导菜单

时间:2015-10-17 13:23:19

标签: twitter-bootstrap

我正在使用一个名为ruma的模板使用bootstrap我只使用了模板中的导航栏并尝试了各种添加导航栏的方法。这里没有其他问题似乎能满足我的需求。

<div class="navbar navbar-inverse navbar-static-top" style="border-bottom:none !important;">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="index">JACOB PUNTON</a>
            </div>
            <div class="navbar-collapse collapse">
                <ul class="nav navbar-nav navbar-right">
                    <li><a href="index">HOME</a></li>
                    <li class="nav-selected"><a href="services">SERVICES</a>
					</li>
                    <li><a href="portfolio">PORTFOLIO</a></li>
                    <li><a href="contact">CONTACT</a></li>
                </ul>
            </div>
        </div>
    </div>

这是我的HTML,我需要在服务下添加一个下拉列表。请帮忙。

2 个答案:

答案 0 :(得分:0)

您好,您需要做的是在列表元素中添加一类下拉列表,您可以这样做

  <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown<i class="fa fa-angle-down"></i></a>
                    <ul class="dropdown-menu">
                        <li><a href="#">Dropdown Link</a></li>
                        <li><a href="#">Dropdown Link</a></li>
                        <li><a href="#">Dropdown Link</a></li>
                    </ul>
                </li>

答案 1 :(得分:0)

如果您前往Docs,您会看到dropdown-menunavbar的完整默认代码示例。请参阅下面的示例代码段。

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

    <ul class="dropdown-menu">
        <li><a href="#">Action</a>

        </li>
        <li><a href="#">Another action</a>

        </li>
        <li><a href="#">Something else here</a>

        </li>
        <li role="separator" class="divider"></li>
        <li><a href="#">Separated link</a>

        </li>
        <li role="separator" class="divider"></li>
        <li><a href="#">One more separated link</a>

        </li>
    </ul>
</li>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="navbar navbar-inverse navbar-static-top" style="border-bottom:none !important;">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>

      </button> <a class="navbar-brand" href="index">JACOB PUNTON</a>

    </div>
    <div class="navbar-collapse collapse">
      <ul class="nav navbar-nav navbar-right">
        <li><a href="index">HOME</a>

        </li>
        <li class="nav-selected"><a href="services">SERVICES</a>

        </li>
        <li><a href="portfolio">PORTFOLIO</a>

        </li>
        <li><a href="contact">CONTACT</a>

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

          <ul class="dropdown-menu">
            <li><a href="#">Action</a>
            </li>
            <li><a href="#">Another action</a>
            </li>
            <li><a href="#">Something else here</a>
            </li>
            <li role="separator" class="divider"></li>
            <li><a href="#">Separated link</a>
            </li>
            <li role="separator" class="divider"></li>
            <li><a href="#">One more separated link</a>
            </li>
          </ul>
        </li>
      </ul>
    </div>
  </div>
</div>