我有一个按钮,单击该按钮后,我会在Bootstrap模型中显示一个表单。我要实现的是在表单提交上显示确认框。一切都很好,但是确认出现在引导模型的背景下。

的HTML

<div class="text-right">
    <button type="button" class="btn btn-primary waves-effect waves-light" data-toggle="modal" data-target=".bs-example-modal-lg">Notify Customer</button>
</div>

<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
    <div class  ="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title mt-0" id="myLargeModalLabel">Notification Message</h5>
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            </div>
            <div class="modal-body">
                <form class="form-horizontal submit-notify" method="POST" action="{{route('backend.customers.notify', $customer->id)}}">
                    {{csrf_field()}}

                    <div class="form-group">
                        <label for="title" class="col-form-label">Title</label>
                        <div>
                            <input  type="text" name="title" class="form-control" required placeholder="Enter Notification Title"  value="@if(old('title')){{old('title')}}@endif" />
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="message" class="col-form-label">Message</label>
                        <div>
                            <textarea  type="text" name="message" class="form-control" rows="5" placeholder="Enter Notification Message">@if(old('message')){{old('message')}}@endif</textarea>
                        </div>
                    </div>

                    <div class="form-group">
                        <label>Options</label>
                        <div>
                            <label  class="custom-control custom-checkbox" style="display: inline-block !important;">
                                <input type="checkbox" class="checkbox m-r-10" name="options[]" value="mail" data-parsley-required="true" data-parsley-multiple="groups"
                                       data-parsley-mincheck="1">
                                <span class="custom-control-indicator"></span>
                                <span class="custom-control-indicator">Mail</span>
                            </label>

                            <label class="custom-control custom-checkbox" style="display: inline-block !important;">
                                <input type="checkbox" class="checkbox m-r-10" name="options[]" value="push" data-parsley-multiple="groups"
                                       data-parsley-mincheck="1">
                                <span class="custom-control-indicator"></span>
                                <span class="custom-control-indicator">Push</span>
                            </label>
                            <span id="error-box"></span>
                        </div>
                    </div>

                    <div class="form-group">
                        <div>
                            <button type="submit" class="btn btn-pink waves-effect waves-light confirm-submit">
                                Send
                            </button>
                        </div>
                    </div>

                </form>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->


这是用于alertyfy的JavaScript。

Java脚本

<script type="text/javascript">
        $(document).ready(function () {
            $(".confirm-submit").on('click',function(event){
                event.preventDefault();
                var form = $(this).closest('form');
                var confirm = alertify.confirm("Are you sure you want to submit details ?",function (e) {
                    if(e){
                        form.submit();
                    }
                    else{
                        return false;
                    }
                });
            });
        });
    </script>


我已经尝试按照堆栈溢出和介质中的建议进行以下两个操作。

第一

通过从模型中删除tabindex="-1"

在这里推荐:alertify upon a bootstrap modal not working

第二

通过放置以下CSS:

.alertify-logs{
     z-index:999999 !important;
}


在我看来,这些都不起作用。怎么了我正在使用laravel框架。

最佳答案

最后,以下是我的CSS技巧,javascript没问题,

.alertify{
    z-index:999999 !important;
    margin-top: -50px;
}


弹出alertyfy的主要div类是.alertyfy,在该div上添加z-index对我来说很有效。

10-05 18:42