如何解决BsDatePicker隐藏在模态后面
<!-- The Server Modal -->
<div class="modal" id="serverModal">
<div
class="modal-dialog"
style="max-width: 80%;overflow-y: initial !important;"
>
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">
User # {{ globals.currentUser }}
</h4>
</div>
<!-- Modal body -->
<div
class="modal-body"
style="max-height: calc(100vh - 200px);
overflow-y: auto;"
>
<table class="table table-striped table-bordered">
<tbody>
<tr>
<td>
<div class="row">
<div class="col-6" style="width:150px;">
ObsoleteServerActionDate
</div>
<div class="form-group col-6">
<input
type="text"
placeholder="DOJ"
class="form-control"
bsDatepicker
[bsConfig]="{
dateInputFormat: 'MM/DD/YYYY',containerClass: 'theme-dark-blue'
}"
/>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Modal footer -->
<div class="modal-footer">
<button
type="button"
class="btn btn-primary"
data-dismiss="modal"
(click)="SaveServer()"
>
Save
</button>
<button
type="button"
class="btn btn-danger"
data-dismiss="modal"
(click)="CancelServer()"
>
Cancel
</button>
</div>
</div>
</div>
</div>
模态内的表中有一个bsDatePicker
。当我打开模式时,日期选择器只是隐藏在模式后面。
我通过为z-index
输入元素提供一个类并设置其bsDatePicker
来尝试z-index: 3000 !important
解决方案,但是它仍然显示在模式后面。为什么要这样做?
解决方法
我想您需要将z-index
设置为容器元素。您应该改为这样做:
.theme-dark-blue {
z-index: 3000 !important;
}
由于它具有config属性,因此您可以利用它:
[bsConfig]="{ dateInputFormat: 'MM/DD/YYYY',containerClass: 'theme-dark-blue show-at-top' }"
.show-at-top{
z-index: 3000 !important;
}
,
在输入元素的父链中,您需要将css position:relative
赋予第一个td
代码中输入元素下方的父元素必须带有position:relative
<input type="text"
placeholder="DOJ"
class="form-control"
bsDatepicker [bsConfig]="{ dateInputFormat: 'MM/DD/YYYY',containerClass: 'theme-dark-blue' }">
我曾经通过在父链的第一个td
元素中解决此问题
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。