Bootstrap 3导航栏下拉菜单全高

时间:2017-07-21 09:05:38

标签: html twitter-bootstrap-3 drop-down-menu navbar dropdown

我有一个带有下拉菜单(https://getbootstrap.com/examples/navbar/)的经典Bootstrap 3导航栏。

我希望菜单下拉列表具有屏幕高度。它有可能吗?

2 个答案:

答案 0 :(得分:0)

为此示例提供height属性可能对此有所帮助。适用于drop-down项目的内嵌式css。

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>

<nav class="navbar navbar-inverse">
  <div class="container-fluid">
    <div class="navbar-header">
      <a class="navbar-brand" href="#">WebSiteName</a>
    </div>
    <ul class="nav navbar-nav">
      <li class="active"><a href="#">Home</a></li>
      <li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#">Page 1 <span class="caret"></span></a>
        <ul class="dropdown-menu" style="height:100vh;">
          <li><a href="#">Page 1-1</a></li>
          <li><a href="#">Page 1-2</a></li>
          <li><a href="#">Page 1-3</a></li>
        </ul>
      </li>
      <li><a href="#">Page 2</a></li>
      <li><a href="#">Page 3</a></li>
    </ul>
  </div>
</nav>
  
<div class="container">
  <h3>Navbar With Dropdown</h3>
  <p>This example adds a dropdown menu for the "Page 1" button in the 


navigation bar.</p>
</div>

</body>
</html>

答案 1 :(得分:0)

我使用此脚本来获得解决方案。

vm.slider_callbacks = { value: 100, options: { floor: 0, ceil: 500, step: 5, showSelectionBar: true, onEnd: function (id, newValue, highValue, pointerType) { vm.radius = newValue >= 500 ? 9999 : newValue; } } };

可以用CSS吗?