Full calendar not showing inside boot modal

I want to load a modal dialog using bootstrap modal. Inside this, I want to show fullcalendar (jquery one) with some events on it. I created my modal and put it in the full calendar. But the full calendar will not be displayed when a modality appears. But this shows when, after the appearance of the modality, I click on the next or previous buttons. But the event does not appear on the calendar. jsfiddle here and code

<a href="#myModal" role="button" class="btn btn-default" data-toggle="modal">Launch demo modal</a> <div id="myModal" class="modal fade" 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">ร—</button> <h3 id="myModalLabel">Modal header</h3> </div> <div class="modal-body"> <div class="row"> <div class="col-xs-6"> <div id="calendar"></div> </div> </div> </div> <div class="modal-footer"> <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button> <button class="btn btn-primary">Save changes</button> </div> </div> </div> 

Js

 $("#calendar").fullCalendar({ header:{ left:'prev', center:'title', right:'next' }, events:'/eventsfeed/', defaultView:'agendaDay' }); 

It also causes events not to appear on the calendar. This is what my / eventsfeed returns

 [{"url": "/calendar/entry/223", "start": "2013-12-04T17:00:00Z", "end": "2013-10-04T16:45:00Z", "description": "a body", "title": "Title entry"}] 

I use fullcalendar on different pages of my project and events, and everything looks fine.

How can I load it when modal appears

+7
javascript jquery twitter-bootstrap twitter-bootstrap-3 fullcalendar
source share
1 answer

You should try the following:

 $('#myModal').on('shown.bs.modal', function () { $("#calendar").fullCalendar('render'); }); 

Here is your fiddle: http://jsfiddle.net/mzAEj/2/

Here is the documentation: http://arshaw.com/fullcalendar/docs/display/render/

+32
source share

All Articles