简体   繁体   English

Bootstrap datetimepicker在tab-content框内部切断

[英]Bootstrap datetimepicker cut off inside of tab-content box

I'm using eonasdan-bootstrap-datetimepicker. 我正在使用eonasdan-bootstrap-datetimepicker。 Please see the pics here first: 请先在这里看图片:

  1. The datetimepicker is within the Bootstrap tab-content control and is cut off by the upper margin. datetimepicker位于Bootstrap选项卡内容控件中,并被上边距切断。

    screenshot of without br tags 没有br标签的屏幕截图

    在此输入图像描述

  2. A layer of br tags add padding, thus allowing the full datetimepicker to reveal itself. 一层br标签添加填充,从而允许完整的datetimepicker显示自己。

    screenshot of br tags included 包含br标签的屏幕截图

    在此输入图像描述

Here is the markup of the form without the br tags below form-group: 这是没有form-group下面的br标签的表单的标记:

<form class="form-horizontal mt-sm" action='' method="POST">
    <fieldset>    
        <div class="form-group">
            <label for="expiration-date" class="control-label col-md-3">Expiration Date</label>
            <div class="col-md-8">
                <div class="col-md-10"><input type="text" id="expiration-date" class="form-control"></div>
            </div>
        </div>
    </fieldset>
</form>

Here are the scripts: 以下是脚本:

<script src="/lib/bootstrap-select/dist/js/bootstrap-select.min.js"></script>
<script src="/lib/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js"></script>
<script src="/lib/select2/select2.min.js"></script>
<script src="/bower_components/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js"></script>
<link rel="stylesheet" href="/bower_components/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css" />

The issue is that the z-index of your tabs are higher than the date-picker UI. 问题是选项卡的z-index高于日期选择器UI。 So to resolve this you must increase the z-index of the date picker UI. 因此,要解决此问题,您必须增加日期选择器UI的z-index。

.datepicker {
    z-index: 1151;
}

Make sure you change the selector to be more specific on required .datepicker elements. 确保将选择器更改为更具体的所需.datepicker元素。 Also make sure that this style takes the priority. 还要确保此样式优先。 In my case I had to use z-index: 1151 !important; 在我的情况下,我不得不使用z-index: 1151 !important; But I don't recommend it unless you are able to get this working without the !important . 但我不推荐它,除非你能够在没有!important情况下使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM