向下树结构中的多下拉列表

时间:2018-06-04 07:18:15

标签: html css angular

我想创建一个总是向下显示的多下拉列表。我能把它放到一边但是我怎么才把它放下?我一直在网上搜索一段时间,但我无法找到一个简单的解决方案。

我使用Angular 5作为我的语言,所以也许有一些角度我可以使用的方法?

为了说明我的意思,请看下面的图片。

Multi dropdown which goes downwards

这是我的工作代码的副本,它是侧面的,我们可以看到有很多子菜单,这就是为什么在这种情况下使用向下的树木结构会更好。



.dropdown-submenu {
    position: relative;
}

.dropdown-submenu>.dropdown-menu {
    top: 0;
    left: 100%;
    margin-top: -6px;
    margin-left: -1px;
    -webkit-border-radius: 0 6px 6px 6px;
    -moz-border-radius: 0 6px 6px;
    border-radius: 0 6px 6px 6px;
}

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

.dropdown-submenu>a:after {
    display: block;
    content: " ";
    float: right;
    width: 0;
    height: 0;
    border-color: transparent;
    border-style: solid;
    border-width: 5px 0 5px 5px;
    border-left-color: #ccc;
    margin-top: 5px;
    margin-right: -10px;
}

.dropdown-submenu:hover>a:after {
    border-left-color: #fff;
}

.dropdown-submenu.pull-left {
    float: none;
}

.dropdown-submenu.pull-left>.dropdown-menu {
    left: -100%;
    margin-left: 10px;
    -webkit-border-radius: 6px 0 6px 6px;
    -moz-border-radius: 6px 0 6px 6px;
    border-radius: 6px 0 6px 6px;
}

<div class="container">
    <div class="row">
      <div class="dropdown">
        <a id="dLabel" role="button" data-toggle="dropdown" class="btn btn-primary" data-target="#" href="/page.html">
          Top folder
          <span class="caret"></span>
        </a>
        <ul class="dropdown-menu multi-level" role="menu" aria-labelledby="dropdownMenu">
          <li class="dropdown-submenu">
            <a tabindex="-1" href="#">Build Verification</a>
            <ul class="dropdown-menu">
              <li class="dropdown-submenu">
                <a href="#">Daily (Commit)</a>
                <ul class="dropdown-menu">
                  <li class="dropdown-submenu">
                    <a href="#">Data Processing</a>
                    <ul class="dropdown-menu">
                      <li class="dropdown-submenu">
                        <a href="#">Toolbar</a>
                        <ul class="dropdown-menu">
                          <li>
                            <a href="#">Project Browser</a>
                          </li>
                          <li>
                            <a href="#">Hardware Browser</a>
                          </li>
                          <li>
                            <a href="#">Monitor</a>
                          </li>
                          <li>
                            <a href="#">Data Search</a>
                          </li>
                          <li>
                            <a href="#">Meta Data</a>
                          </li>
                        </ul>
                      </li>
                      <li class="dropdown-submenu">
                        <a href="#">Tasks</a>
                        <ul class="dropdown-menu">
                          <li class="dropdown-submenu">
                            <a href="#">Setup</a>
                            <ul class="dropdown-menu">
                              <li>
                                <a href="#">Hammer</a>
                              </li>
                              <li>
                                <a href="#"> Manger</a>
                              </li>
                              <li>
                                <a href="#">Shaker</a>
                              </li>
                              <li>
                                <a href="#">DOFSetup</a>
                              </li>
                              <li>
                                <a href="#">Analysis Setup</a>
                              </li>
                            </ul>
                          </li>
                          <li class="dropdown-submenu">
                            <a href="#">Measurement</a>
                            <ul class="dropdown-menu">
                              <li>
                                <a href="#">Standard Measurement</a>
                              </li>
                            </ul>
                          </li>
                          <li class="dropdown-submenu">
                            <a href="#">Processing</a>
                            <ul class="dropdown-menu">
                              <li>
                                <a href="#">Time Data Review</a>
                              </li>
                              <li>
                                <a href="#">Standard Processing</a>
                              </li>
                              <li>
                                <a href="#">Time Editor</a>
                              </li>
                            </ul>
                          </li>
                          <li>
                            <a href="#">Analysis</a>
                          </li>
                        </ul>
                      </li>
                    </ul>
                  </li>
                  <li>
                    <a href="#">Hardware Setup</a>
                  </li>
                  <li>
                    <a href="#">Data Viewer</a>
                  </li>
                  <li>
                    <a href="#">Array Analysis</a>
                  </li>
                  <li>
                    <a href="#">ODS Analysis</a>
                  </li>
                  <li>
                    <a href="#">Shock Response Analysis</a>
                  </li>
                  <li>
                    <a href="#">Angle Domain Analysis</a>
                  </li>
                  <li>
                    <a href="#">Modal Analysis</a>
                  </li>
                  <li>
                    <a href="#">Correlation Analysis</a>
                  </li>
                  <li>
                    <a href="#">Data Recorder</a>
                  </li>
                </ul>
              </li>
              <li>
                <a href="#">CI</a>
              </li>
            </ul>
          </li>

          <li>
            <a href="#">Deploy (Install)</a>
          </li>
          <li>
            <a href="#">Front-end Setup</a>
          </li>
          <li>
            <a href="#">Correlation Analysis</a>
          </li>
          <li>
            <a href="#">Laser</a>
          </li>
          <li>
            <a href="#">Model Analysis</a>
          </li>
          <li>
            <a href="#">Angle Domain Analysis</a>
          </li>
          <li>
            <a href="#">Shock Response Analysis</a>
          </li>
          <li>
            <a href="#">ODS Analysis</a>
          </li>
          <li>
            <a href="#">Array Analysis</a>
          </li>
          <li>
            <a href="#">Data Processing</a>
          </li>
          <li>
            <a href="#">Frontends</a>
          </li>
          <li>
            <a href="#">Data Recorder</a>
          </li>
          <li>
            <a href="#">Container</a>
          </li>
          <li>
            <a href="#">Data Viewer</a>
          </li>
          <li>
            <a href="#">Hardware</a>
          </li>
          <li>
            <a href="#">Test Environment</a>
          </li>
        </ul>
      </div>
    </div>
  </div> 
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:2)

你是想达到这样的目标吗?

&#13;
&#13;
.dropdown-submenu {
    position: relative;
}

.dropdown-submenu>.dropdown-menu {
    top: 0;
    left: 100%;
    margin-top: -1px;
    margin-left: -32px;
    -webkit-border-radius: 0 6px 6px 6px;
    -moz-border-radius: 0 6px 6px;
    border-radius: 0 6px 6px 6px;
    display:none;
}

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

.dropdown-submenu>a:after {
    display: block;
    content: " ";
    float: right;
    width: 0;
    height: 0;
    border-color: transparent;
    border-style: solid;
    border-width: 5px 0 5px 5px;
    border-left-color: #ccc;
    margin-top: 5px;
    margin-right: -10px;
}

.dropdown-submenu:hover>a:after {
    border-left-color: #fff;
}

.dropdown-submenu.pull-left {
    float: none;
}

.dropdown-submenu.pull-left>.dropdown-menu {
    left: -100%;
    margin-left: 10px;
    -webkit-border-radius: 6px 0 6px 6px;
    -moz-border-radius: 6px 0 6px 6px;
    border-radius: 6px 0 6px 6px;
}
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container">
    <div class="row">
      <div class="dropdown">
        <a id="dLabel" role="button" data-toggle="dropdown" class="btn btn-primary" data-target="#" href="/page.html">
          Top folder
          <span class="caret"></span>
        </a>
        <ul class="dropdown-menu multi-level" role="menu" aria-labelledby="dropdownMenu">
          <li class="dropdown-submenu">
            <a tabindex="-1" href="#">Build Verification</a>
            <ul class="dropdown-menu">
              <li class="dropdown-submenu">
                <a href="#">Daily (Commit)</a>
                <ul class="dropdown-menu">
                  <li class="dropdown-submenu">
                    <a href="#">Data Processing</a>
                    <ul class="dropdown-menu">
                      <li class="dropdown-submenu">
                        <a href="#">Toolbar</a>
                        <ul class="dropdown-menu">
                          <li>
                            <a href="#">Project Browser</a>
                          </li>
                          <li>
                            <a href="#">Hardware Browser</a>
                          </li>
                          <li>
                            <a href="#">Monitor</a>
                          </li>
                          <li>
                            <a href="#">Data Search</a>
                          </li>
                          <li>
                            <a href="#">Meta Data</a>
                          </li>
                        </ul>
                      </li>
                      <li class="dropdown-submenu">
                        <a href="#">Tasks</a>
                        <ul class="dropdown-menu">
                          <li class="dropdown-submenu">
                            <a href="#">Setup</a>
                            <ul class="dropdown-menu">
                              <li>
                                <a href="#">Hammer</a>
                              </li>
                              <li>
                                <a href="#"> Manger</a>
                              </li>
                              <li>
                                <a href="#">Shaker</a>
                              </li>
                              <li>
                                <a href="#">DOFSetup</a>
                              </li>
                              <li>
                                <a href="#">Analysis Setup</a>
                              </li>
                            </ul>
                          </li>
                          <li class="dropdown-submenu">
                            <a href="#">Measurement</a>
                            <ul class="dropdown-menu">
                              <li>
                                <a href="#">Standard Measurement</a>
                              </li>
                            </ul>
                          </li>
                          <li class="dropdown-submenu">
                            <a href="#">Processing</a>
                            <ul class="dropdown-menu">
                              <li>
                                <a href="#">Time Data Review</a>
                              </li>
                              <li>
                                <a href="#">Standard Processing</a>
                              </li>
                              <li>
                                <a href="#">Time Editor</a>
                              </li>
                            </ul>
                          </li>
                          <li>
                            <a href="#">Analysis</a>
                          </li>
                        </ul>
                      </li>
                    </ul>
                  </li>
                  <li>
                    <a href="#">Hardware Setup</a>
                  </li>
                  <li>
                    <a href="#">Data Viewer</a>
                  </li>
                  <li>
                    <a href="#">Array Analysis</a>
                  </li>
                  <li>
                    <a href="#">ODS Analysis</a>
                  </li>
                  <li>
                    <a href="#">Shock Response Analysis</a>
                  </li>
                  <li>
                    <a href="#">Angle Domain Analysis</a>
                  </li>
                  <li>
                    <a href="#">Modal Analysis</a>
                  </li>
                  <li>
                    <a href="#">Correlation Analysis</a>
                  </li>
                  <li>
                    <a href="#">Data Recorder</a>
                  </li>
                </ul>
              </li>
              <li>
                <a href="#">CI</a>
              </li>
            </ul>
          </li>

          <li>
            <a href="#">Deploy (Install)</a>
          </li>
          <li>
            <a href="#">Front-end Setup</a>
          </li>
          <li>
            <a href="#">Correlation Analysis</a>
          </li>
          <li>
            <a href="#">Laser</a>
          </li>
          <li>
            <a href="#">Model Analysis</a>
          </li>
          <li>
            <a href="#">Angle Domain Analysis</a>
          </li>
          <li>
            <a href="#">Shock Response Analysis</a>
          </li>
          <li>
            <a href="#">ODS Analysis</a>
          </li>
          <li>
            <a href="#">Array Analysis</a>
          </li>
          <li>
            <a href="#">Data Processing</a>
          </li>
          <li>
            <a href="#">Frontends</a>
          </li>
          <li>
            <a href="#">Data Recorder</a>
          </li>
          <li>
            <a href="#">Container</a>
          </li>
          <li>
            <a href="#">Data Viewer</a>
          </li>
          <li>
            <a href="#">Hardware</a>
          </li>
          <li>
            <a href="#">Test Environment</a>
          </li>
        </ul>
      </div>
    </div>
  </div>
&#13;
&#13;
&#13;