jQuery   发布时间:2022-03-30  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了jquery – 如何让BootPrap(Plugin)的ClockPicker出现在Bootstrap Modal弹出窗体中?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
以下是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">&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-index高于时钟模态的z-index.

解决此问题,您需要做的就是在CSS中添加

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

大佬总结

以上是大佬教程为你收集整理的jquery – 如何让BootPrap(Plugin)的ClockPicker出现在Bootstrap Modal弹出窗体中?全部内容,希望文章能够帮你解决jquery – 如何让BootPrap(Plugin)的ClockPicker出现在Bootstrap Modal弹出窗体中?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。