在整个日历淡入与引导模式



我试图在一个引导模式,有一个完整的日历在它没有完整的日历弹出淡出。在开始模态渐变之前,我该如何渲染日历?

html

<!-- Button trigger modal -->
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">Launch demo modal</button>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                 <h4 class="modal-title" id="myModalLabel">Modal title</h4>
            </div>
            <div class="modal-body">
                <div id='calendar'></div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary">Save changes</button>
            </div>
        </div>
    </div>
</div>

js

$(document).ready(function () {
    $('#calendar').fullCalendar({
    })
    $('#myModal').on('shown.bs.modal', function (e) {
        $('#calendar').fullCalendar('render');
    });
});
http://jsfiddle.net/waspinator/HfSLs/3/

fade类从模态中移除,并将JS更改为:

$(document).ready(function () {
    $('#calendar').fullCalendar({
    })
    var shown = false;
    $('#myModal').on('shown.bs.modal', function (e) {
        if(shown === false) { 
            shown = true; 
            $('#calendar').fullCalendar('render');
            $('#myModal').modal('hide');
            $('#myModal').addClass('fade');
            $('#myModal').modal('show');
        }
    });
});
http://jsfiddle.net/waspinator/HfSLs/5/

相关内容

  • 没有找到相关文章

最新更新