【发布时间】:2014-05-27 08:32:16
【问题描述】:
想知道是否有人对如何增加下拉菜单的宽度有任何提示?
我有一行包含两列,其中包含一些 javascript,在选中时会上下滑动下拉列表。我遇到的问题是,我似乎无法弄清楚如何在选择时增加下拉列表的宽度,理想情况下下拉列表将与列大小匹配。但是发生的情况是下拉列表的宽度仅与下拉列表中的文本大小相同,有人对如何增加下拉列表宽度以匹配列大小有任何建议吗?
<div class="row question">
<div class="dropdown">
<div class="col-md-6" data-toggle="dropdown">
First column
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
<li>Insert your menus here</li>
<li>Insert your menus here</li>
<li>Insert your menus here</li>
<li>Insert your menus here</li>
<li>Insert your menus here</li>
<li>Insert your menus here</li>
</ul>
</div>
</div><!-- end of the dropdown -->
<div class="dropdown">
<div class="col-md-6" data-toggle="dropdown">
second column
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
<li>Insert your menus here</li>
<li>Insert your menus here</li>
<li>Insert your menus here</li>
<li>Insert your menus here</li>
<li>Insert your menus here</li>
<li>Insert your menus here</li>
</ul>
</div>
</div>
</div><!--end of the row question -->
<script>
// ADD SLIDEDOWN ANIMATION TO DROPDOWN //
$('.dropdown').on('show.bs.dropdown', function(e){
$(this).find('.dropdown-menu').first().stop(true, true).slideDown();
});
// ADD SLIDEUP ANIMATION TO DROPDOWN //
$('.dropdown').on('hide.bs.dropdown', function(e){
$(this).find('.dropdown-menu').first().stop(true, true).slideUp();
});
</script>
【问题讨论】:
-
你的 CSS 在哪里?这是一个 JS Fiddel,您可以在其中添加它,向我们展示:jsfiddle.net/h53UE/1
标签: jquery html css twitter-bootstrap bootstrap-4