Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
469 views
in Technique[技术] by (71.8m points)

javascript - 引导模型背景出现Alertyfy弹出窗口(Alertyfy pop up appearing at background of bootstrap model)

I have a button and upon clicking that button I am showing a form in bootstrap model.

(我有一个按钮,单击该按钮后,我会在Bootstrap模型中显示一个表单。)

What I want to achieve is to show confirmation box on form submit.

(我要实现的是在表单提交上显示确认框。)

Everything is fine but confirmation is appear at the background of bootstrap model.

(一切都很好,但是确认出现在引导模型的背景下。)

HTML

(的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 -->

Here is the javascript for alertyfy.

(这是用于alertyfy的JavaScript。)

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>

I have tried following two as recommended in stack overflow and medium.

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

First

(第一)

By removing tabindex="-1" from model.

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

Recommended here: alertify upon a bootstrap modal not working

(在这里推荐: 在引导模态不起作用时发出警报)

Second

(第二)

By placing following css:

(通过放置以下CSS:)

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

None of these work in my case.

(在我看来,这些都不起作用。)

What would be the problem.

(怎么了)

I am using laravel framework.

(我正在使用laravel框架。)

  ask by Sagar Gautam translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Finally a following css trick for me and nothing problem with javascript,

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

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

Main div class for alertyfy pop up was .alertyfy and adding z-index on that div worked for me.

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...