以下是ClockPicker for Bootstrap的链接: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">×</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>
答案 0 :(得分:6)
我用你的代码制作了JSFiddle。
我怀疑问题是模态的z-index高于时钟模态的z-index。
要解决此问题,您需要做的就是在CSS中添加:
.clockpicker-popover {
z-index: 999999;
}
答案 1 :(得分:1)
我只用这个解决了这个问题
.popover {
z-index: 215000000 !important;
}
答案 2 :(得分:0)
只需将此样式添加到您的时间选择器
.clockpicker-popover
{
z-index: 999999 !important;
}
答案 3 :(得分:-1)
Solo Ordena las hojas de estilo para sobreponer los elementos: Primero JQuery Seguido Clockpicker 最终的Bootstrap
Ejemplo:
<!-- jQuery -->
<script src="../librerias/jquery/jquery-3.4.1.min.js"></script>
<!-- Clockpicker -->
<link rel="stylesheet" type="text/css" href="../librerias/clockpicker/css/jquery-clockpicker.min.css">
<script type="text/javascript" src="../librerias/clockpicker/js/jquery-clockpicker.min.js"></script>
<!-- Bootstrap -->
<link rel="stylesheet" type="text/css" href="../librerias/bootstrap/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="../librerias/bootstrap/css/bootstrap.min.css">
<script src="../librerias/bootstrap/js/bootstrap.min.js"></script>