我使用了这个fullcalendar-scheduler我尝试为这些事件添加了Modal Popup对话框,它不适合我,请帮我解决这个问题。
事件功能
eventClick: function(event, jsEvent, view) {
$('#modalTitle').html(event.title);
$('#modalBody').html(event.description);
$('#eventUrl').attr('href',event.url);
$('#calendarModal').modal();
},
这是我的代码
<script>
$(function() { // document ready
$('#calendar').fullCalendar({
now: '2017-12',
editable: true, // enable draggable events
height: 'auto',
header: {
left: 'today prev,next',
center: 'title',
right: 'timelineMonth,timelineYear'
},
defaultView: 'timelineThreeDays',
navLinks: true,
resourceAreaWidth: '15%',
views: {
timelineThreeDays: {
type: 'timeline',
duration: { days: 31}
}
},
resourceLabelText: 'Single Rooms (8)',
resources: [
{ id: 'a', title: 'Room # 1' },
{ id: 'b', title: 'Room # 2', eventColor: 'green' },
{ id: 'c', title: 'Room # 3', eventColor: 'orange' },
{ id: 'd', title: 'Room # 4', children: [
] },
{ id: 'e', title: 'Room # 5' },
{ id: 'f', title: 'Room # 6', eventColor: 'red' },
{ id: 'g', title: 'Room # 7', eventColor: 'orange' },
{ id: 'h', title: 'Room # 8',eventColor: 'green' },
],
events: [
// normal events...
{ id: '1', resourceId: 'a', start: '2017-12-01', end: '2017-12-07', title: 'Mahesh' },
{ id: '2', resourceId: 'b', start: '2017-12-12', end: '2017-12-15', title: 'Anushka' },
{ id: '3', resourceId: 'c', start: '2017-12-11', end: '2017-12-15', title: 'Ramesh' },
{ id: '4', resourceId: 'd', start: '2017-12-11', end: '2017-12-19', title: 'Susena' },
{ id: '5', resourceId: 'e', start: '2017-12-15', end: '2017-12-28', title: 'Lahiru' },
{ id: '6', resourceId: 'f', start: '2017-12-01', end: '2017-12-10', title: 'Chamath' },
{ id: '7', resourceId: 'g', start: '2017-12-10', end: '2017-12-11', title: 'Channa' },
{ id: '8', resourceId: 'h', start: '2017-12-09', end: '2017-12-14', title: 'Ganesh' }
],
eventClick: function(event, jsEvent, view) {
$('#modalTitle').html(event.title);
$('#modalBody').html(event.description);
$('#eventUrl').attr('href',event.url);
$('#calendarModal').modal();
},
});
});
</script>
模态
<div id="calendarModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span> <span class="sr-only">close</span></button>
<h4 id="modalTitle" class="modal-title"></h4>
</div>
<div id="modalBody" class="modal-body"> </div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Modal -->
提前致谢
答案 0 :(得分:0)
OMG,这是现在的工作,简直就是我的错误,
之前&gt;&gt;我用bootstrap.js
现在我替换了bootstrap.min.js
现在正在工作:)
答案 1 :(得分:0)
这是因为Modal元素(Bootstrap Modals)内的任何DOM元素都将被隐藏,因此Calendar对象不会被渲染。解决方法是在切换器上单击事件后初始化日历。
# HTML
<button id="toggler" data-toggle="modal" data-target="#modal_calendar"></button>
<div id="modal_calendar" class="modal" role="dialog">
<div class="modal-content">
<div class="modal-body">
<div class="calendar"></div>
</div>
</div>
</div>
# Script
<script>
(function($){
$('#toggler').on('click', function(){
$('.calendar').fullCalendar();
})
})(jQuery)
</script>