我有一个bootstrap3响应表,其中包含每行中的下拉选择(使用无序列表元素)。点击下拉菜单后,用户将被迫滚动查看所有选项,而在较小的屏幕上,我甚至无法滚动显示。在引导响应表中显示下拉菜单
我试图使它可以出现在表格顶部而不是在/之后(这将强制垂直滚动)。我试过改变了li
,ul
的z-index
和overflow-y
属性,并在CSS中包含div
元素,但它没有什么区别。
相似,所以问题还没有收到一个公认的/工作答案之一:
"dropdown button get cutoff by responsive table in bootstrap 3"
"Bootstrap dropdown menu within a responsive table"
"Responsive table issues in bootstrap"
我怎样才能使列表中出现浮在顶部/外响应表?这甚至有可能吗?
的jsfiddle:
https://jsfiddle.net/vndyLy1e/3/
HTML:
<div class="table-responsive">
<table class="table table-striped table-condensed" style="z-index: 1">
<thead>
<tr>
<th class="col-xs-2 col-md-3">Col 1</th>
<th class="col-xs-1 col-md-2">Col 2</th>
<th class="col-xs-1 col-md-2">Col 3</th>
<th class="col-xs-1 col-md-2">Col 4</th>
<th class="col-xs-1 col-md-1">Col 5</th>
<th class="col-xs-1 col-md-1">Col 6</th>
<th class="col-xs-1 col-md-1"></th>
</tr>
</thead>
<tbody class="table-body">
<tr>
<td>$Col 1 Data</td>
<td>$Col 2 Data</td>
<td>$Col 3 Data</td>
<td>$Col 4 Data</td>
<td>$Col 4 Data</td>
<td>$Col 5 Data</td>
<!-- Action Dropdown-->
<td>
<div class="btn-group">
<button type="button" class="btn btn-default btn-transparent btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="title-element-name">Actions </span><span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a>Drop Option 1</a></li>
<li><a>Drop Option 2</a></li>
<li><a>Drop Option 3</a></li>
<li><a>Drop Option 4</a></li>
</ul>
</div>
</td>
</tr>
</tbody>
</table>
</div>
CSS:
.dropdown-menu {
overflow-y: visible !important;
z-index: 999;
ul {
overflow-y: visible !important;
}
li {
overflow-y: visible !important;
}
li:hover {
cursor: pointer;
cursor: hand;
}
}
.title-element-name {
color: #FF8200;
font-weight: bold;
}
.table-responsive {
z-index: 999;
overflow-y: auto !important;
}
顶级的表的手段? –
您已将其添加到您的模板中。这意味着它会出现在你桌子的每一行。如果你想在桌子外面,将它移到你的模板范围之外。 – jmag
@jmag:它应该在每一行中。问题在于下拉可视性。 – DjH