我的应用程序中有FullCalendar jQuery插件,但我需要知道如何在指定的小时范围内启用eventClick(甚至选择)。(如果解决方案在其他时间被禁用,也可能很好)
我的代码:
$('#calendarDay').fullCalendar({
dayClick: function(date, jsEvent, view) {
if (view.name != 'month')
return;
if (view.name == 'month') {
$('#calendarDay').fullCalendar('changeView', 'agendaDay');
$('#calendarDay').fullCalendar('gotoDate', date);
}
},
header: {
left: 'prev,next today',
center: 'title',
right: 'agendaDay, agendaWeek, month'
},
defaultView: 'agendaWeek',
eventLimit: true,
selectable: true,
selectHelper: true,
eventColor: '#FFA549',
allDaySlot: false,
minTime: '07:30:00',
maxTime: '23:00:00',
aspectRatio: 2.2,
height: 'auto',
businessHours:
{
start: '14:30',
end: '16:00',
dow: [ 1, 2, 3, 4, 5 ]
},
select: function(start, end) {
//var title = true;
var eventData;
//if (title) {
eventData = {
title: "Carregamento",
start: start,
end: end
};
$('#calendarDay').fullCalendar('renderEvent', eventData, true); // stick? = true
//}
$('#calendarDay').fullCalendar('unselect');
},
events: [
{
title: 'Carregamento',
start: '2016-03-17T16:00:00',
end: '2016-03-17T16:30:00'
}
],
});
对我有用(定义选择约束):
selectConstraint:{
start: '14:30',
end: '16:00',
},