bootstrap datepicker隐藏在模态中

时间:2017-08-15 11:18:59

标签: jquery css twitter-bootstrap laravel datepicker

用户需要从模态对话框中选择日期。一切都很完美,除了我没有看到日期选择器对话框(它似乎缩小或类似的东西)这是它的样子 enter image description here

我也尝试将z-index添加到我的css文件中,但这对我来说也不起作用

.date {
    z-index: 999999999;
}

所以这是我的代码

<!doctype html>
<html lang="{{ app()->getLocale() }}">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
        <link href="{{ asset('css/customstyles.css') }}" rel="stylesheet">
        <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.css" rel="stylesheet">
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.js"></script>

        <meta name="csrf-token" content="{{ csrf_token() }}">
        <script type="text/javascript">
            $.ajaxSetup({
                headers: { 'X-CSRF-Token' : $('meta[name=_token]').attr('content') }
            });
        </script>
        <script type="text/javascript" src={{ asset('js/page_scripts.js') }}></script>
        <title>Laravel</title>
    </head>
    <body>
        @yield('navbar')
        @yield('content')
        <script type="text/javascript">
            $('.date').datepicker({
                format: 'mm-dd-yyyy'
            });
        </script>
    </body>
</html>

这是我发生此问题的模式

<div id="add-medicine" class="modal fade" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            {{ Form::open(array('class'=>'form-horizontal', 'onsubmit' => 'return false')) }}
            <div class="modal-header" >
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Prdėti medikamentą</h4>
            </div>

            <div class="modal-body">
                <div class="form-group">
                    {{ Form::label('filldate', 'Data', array('class' => 'control-label col-sm-3')) }}
                    <div class="col-sm-8">
                        <div class="input-group date">

                            {{ Form::text('text', null, array('class' => 'date form-control filldate', 'required'=> '')) }}
                            <span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    {{ Form::label('expiredate', 'Galioja iki', array('class' => 'control-label col-sm-3')) }}
                    <div class="col-sm-8">
                        <div class="input-group date">

                            {{ Form::text('text', '', array('class' => 'date form-control expiredate', 'required'=> '')) }}
                            <span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                {{Form::submit('Išsaugoti', array('class' => 'btn btn-success btn-lg btn-block js-save-new-animal', null))}}
            </div>
            {{ Form::close() }}
        </div>
    </div>
</div>

所以我想念的是什么,我做错了什么?

1 个答案:

答案 0 :(得分:0)

好的,最后我找到了解决方案。似乎1.5.0版本有一些错误,所以我只需要替换为1.7.1版本,现在它可以完美运行。