【发布时间】:2015-04-16 20:49:33
【问题描述】:
我有一个带按钮的 Bootstrap 模式。当我单击按钮时,它会在按钮下方显示一个右侧。包含一个带有锚链接的 ul 列表。
问题是,如果我不将高度设置为更高的值,那么在模态中最后的项目不是可见的,因为 div 在模态之外。
我不想使用溢出,因为我不希望它滚动。模态框内部是我自己制作的下拉菜单。
: 的 CSS
.wrapper-for-dropdown {
width: 300px;
z-index:9999;
color: #333;
background-color: #fff;
position: absolute;
display: none;
border: solid;
border-width: 1px;
border-radius: 4px;
border-color: #ccc;
z-index:32432423432;
overflow-wrap:normal;
}
.wrapper-for-dropdown:hover {
border: solid;
border-width: 1px;
border-color: #ccc;
}
.dropdown-ul {
list-style-type: none;
-moz-st color: white;
text-align: left;
padding-left: 10px;
overflow-y: visible;
}
.dropdown-ul li {
float: left;
display: inline-block;
height: auto;
width: 250px;
}
.dropdown-ul li:hover {
}
.dropdown-ul li a {
color: #38546d;
display: block;
float: left;
}
.dropdown-ul li a:hover {
color: black;
display: block;
float: left;
}
HTML:
<!-- Modal -->
<div class="modal" id="modalCreateNewManualResync" tabindex="-1" role="dialog" aria-labelledby="modalCreateNewManualResyncLabel" aria-hidden="true">
<div class="modal-dialog" id="createNewSyncDialog">
<div class="modal-content" style="">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="modalCreateNewManualResyncLabel">Create New Resync
</h4>
</div>
<!-- Model Body -->
<div class="modal-body" >
<div class="container-fluid">
<div class="modal-content-div">
<label>Company:</label>
<label>Sync Reason:</label>
</div>
<div class="modal-content-div-data">
<button class="btn btn-default" id="buttonCompaniesList" onclick="listCompaniesToogle();" type="button" style="display: inline-block; width: 180px;">Select Company<span id="spanArrowIndicator" style="margin-left: 10px; margin-right: 10px;" class="caret"></span></button>
<div id="wraptest" class="wrapper-for-dropdown">
<ul id="ulcompanies" class="dropdown-ul">
</ul>
</div>
<input type="text" />
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close<span style="margin-left: 10px;" class="glyphicon glyphicon-remove"></span></button>
<button type="button" class="btn btn-default">Create<span style="margin-left: 10px;" class="glyphicon glyphicon-ok"></span></button>
</div>
</div>
</div>
<!--End Of Modal Body -->
</div>
</div>
![GUI 的当前示例。意大利和国际不可点击。][1]
[1]意大利和国际不可点击:http://i.stack.imgur.com/uVcLj.jpg
【问题讨论】:
-
您可能会将
overflow: hidden放在祖先元素上以强制它包含列表。没有演示很难说。 liveweave.com -
也许您可以在自己的风格中使用:
.modal {overflow: visible}和.modal-body {overflow-y: visible} -
div 的高度(下拉)设置为自动。在模态和模态主体上设置溢出样式只会给我一个滚动内容。我不想要那个。我想要一个在模态对话框上展开的下拉菜单,它确实有点无法点击锚点。
标签: javascript html css