如何在悬停时使用ui.bootstrap创建菜单

时间:2016-09-18 13:10:30

标签: html angularjs twitter-bootstrap angular-ui-bootstrap

我是AngularJS的新手。我想创建一个下拉菜单,它也有子菜单。 和下拉菜单&子菜单将在鼠标移动时打开和关闭。

我创建了下拉菜单,但没有找到创建子菜单的方法。

这是我的代码:`                     

    <button type="button" class="navbar-toggle" ng-init="navCollapsed = true" ng-click="navCollapsed = !navCollapsed">
      <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>

  <!-- Collect the nav links, forms, and other content for toggling -->
  <div class="collapse navbar-collapse" ng-class="!navCollapsed && 'in'">

    <ul class="nav navbar-nav">
      <li class="active"><a href="#">Link</a></li>
      <li><a href="#">Link</a></li>

      <li dropdown>
        <a href="#" dropdown-toggle>Dropdown <b class="caret"></b></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><a href="#">Separated link</a></li>
          <li><a href="#">One more separated link</a></li>
        </ul>
      </li>

    </ul>
    <form class="navbar-form navbar-left" role="search">
      <div class="form-group">
        <input type="text" class="form-control" placeholder="Search">
      </div>
      <button type="submit" class="btn btn-default">Submit</button>
    </form>
    <ul class="nav navbar-nav navbar-right">
      <li><a href="#">Link</a></li>
  <li class="btn-group" dropdown>
        <a href="#" dropdown-toggle>Dropdown <b class="caret"></b></a>
        <ul class="dropdown-menu">
          <li  class="dropdown-submenu pull-left"><a href="#">Action</a></li>
          <li><a href="#">Another action</a></li>
          <li><a href="#">Something else here</a></li>
          <li><a href="#">Separated link</a></li>
          <li><a href="#">One more separated link</a></li>
        </ul>
      </li>
    </ul>
  </div><!-- /.navbar-collapse -->
</nav>

`

CSS:

   .btn-group:hover>.dropdown-menu {
  display: block;
}

感谢您的帮助。

0 个答案:

没有答案