我一直在尝试让 fullcalendar 对新事件的轮询做出反应,但是每当它调用 refetchEvents 时,如果我正在拖动或调整某些东西的大小,它就会阻止我,就好像我在我所在的位置释放了鼠标一样,它移动或将事件分别调整到错误的位置。
我有一个jsfiddle,以展示这一点。
这是代码,如果有帮助:
$(document).ready(function() {
/* initialize the calendar
-----------------------------------------------------------------*/
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,
events: [{
title: 'event1',
start: '2017-01-26T08:00:00',
end: '2017-01-26T10:00:00'
}, {
title: 'event2',
start: '2017-01-05',
end: '2017-01-07'
}, {
title: 'event3',
start: '2017-01-09T06:30:00',
end: '2017-01-09T09:30:00',
}]
});
});
setInterval(function() {
$('#calendar').fullCalendar('refetchEvents');
console.log('refetchEvents called');
}, 5000);