这是Bootstrap的ClockPicker的链接:http://www.jqueryrain.com/?B83aD_dg

它运作完美;但是,当我尝试使用它在Bootstrap模态弹出窗口中填充文本输入时,时钟会出现在模态弹出窗口的后面。如何使时钟选择器出现在模式弹出窗口中(或前面)?

这是发生的情况的图像:



我尝试将div的z-index更改为在前面;我还尝试将clockpicker.css中每个元素的z-index更改为最前面(例如:z-index:1120)。但是,所有这些只是使时钟消失了。

<div class="modal fade appointment-modal"
     id="appointment-modal"
     tabindex="-1"
     role="dialog"
     aria-labelledby="myModalLabel"
     aria-hidden="true">

<div class="modal-dialog tutors-modal">
    <div class="modal-content tutors-modal">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            <h4 class="modal-title">Appointment Scheduler</h4>
        </div>
        <div class="modal-body" style="height: 575px; left: 2.5%;">
            <div class="container">
                <div class="row">
                    <div class="col-md-12">
                        <div class="alert alert-danger"><span class="glyphicon glyphicon-alert"></span>
                            <form role="form" action="/portal/make-appointment/" method="post" id="appointment_form" class="form-horizontal">
                                <div class="col-lg-6">

                                    <div class="input-group clockpicker" id = "clockpicker" style="padding: 6px; padding-bottom: 20px;">
                                        <input type="text" class="form-control" id = "time" name="time" value="08:00">
                                        <span class="input-group-addon">
                                            <span class="glyphicon glyphicon-time"></span>
                                        </span>
                                    </div>
                                    <script type="text/javascript">
                                        var input = $('#time');
                                        input.clockpicker({
                                            autoclose: true
                                        });
                                    </script>
                                    <input type="submit" name="submit" id="submit" value="Schedule Appointment" class="btn btn-info pull-right">
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="modal-footer">
        </div>
    </div>
</div>

最佳答案

我用您的代码做了JSFiddle

正如我怀疑的那样,问题在于模态的z索引高于时钟模态的z索引。

为了解决这个问题,您要做的就是在CSS中添加以下内容:

.clockpicker-popover {
    z-index: 999999;
}

08-25 21:32