我正在使用Bootstrap 4.1.3。我有一个导航栏,它显示按钮的水平列表,而折叠时,它显示按钮的垂直列表。在4.0.0 alpha6版本中,我能够将垂直列表显示为下拉列表,而不是按钮列表。有什么办法可以复制4.1.3中的4.0.0行为?随附示例代码...
<!DOCTYPE html>
<html xml:lang="en" lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Display dropdown list instead of buttons when collapsed</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
</head>
<body>
<div class="container-fluid">
<h1>Display dropdown list instead of buttons when collapsed</h1>
<nav class="navbar navbar-expand-md navbar-light">
<span class="navbar-brand"></span>
<button class="navbar-toggler" type="button" data-toggle="collapse"
data-target="#navbarSelect" aria-controls="navbarSelect" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSelect">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<input class="nav-link btn btn-primary" type="submit" name="button1" title="button1" value="Button Text">
</li>
<li class="nav-item">
<input class="nav-link btn btn-primary" type="submit" name="button2" title="button2" value="Button Text">
</li>
<li class="nav-item">
<input class="nav-link btn btn-primary" type="submit" name="button3" title="button3" value="Button Text">
</li>
<li class="nav-item">
<input class="nav-link btn btn-primary" type="submit" name="button4" title="button4" value="Button Text">
</li>
<li class="nav-item">
<input class="nav-link btn btn-primary" type="submit" name="button5" title="button5" value="Button Text">
</li>
</ul>
</div>
</nav>
<section id="no-more-tables">
<table class="table table-striped table-hover table-sm">
<thead>
<tr>
<th>Select</th>
<th>ID</th>
<th>Description</th>
<th>Tasks</th>
</tr>
</thead>
<tbody>
<tr>
<td data-title="Select">
<div class="form-check">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="select[1]" name="select[1]">
<label class="custom-control-label" for="select[1]"> </label>
</div>
</div>
</td>
<td data-title="ID"><p class="form-control-static">ADD1</p></td>
<td data-title="Name"><p class="form-control-static">ADD1 - Insert a single record</p></td>
<td data-title="Tasks" class="right"><p class="form-control-static">193</p></td>
</tr>
<tr>
<td data-title="Select">
<div class="form-check">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="select[2]" name="select[2]">
<label class="custom-control-label" for="select[2]"> </label>
</div>
</div>
</td>
<td data-title="ID"><p class="form-control-static">ADD2</p></td>
<td data-title="Name"><p class="form-control-static">ADD2 - Insert a single record</p></td>
<td data-title="Tasks" class="right"><p class="form-control-static">227</p></td>
</tr>
<tbody>
</table>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"> </script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"> </script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"> </script>
</body>
</html>