我创建了一个外部事件面板,允许用户将事件拖到完整的日历 - 调度程序视图中。但我希望可拖动事件在用户在日历上发布事件时固定开始时间和结束时间。我怎样才能做到这一点?我已经尝试过每个事件,并为它提供开始时间。
我的代码:
$('#external-events .fc-event').each(function () {
// store data so the calendar knows to render an event upon drop
$(this).data('event', {
title: $.trim($(this).text()), // use the element's text as the event title
stick: true, // maintain when user navigates (see docs on the renderEvent method)
start: "09:00",
time: "09:00",
durationEditable: false,
duration: "09:00"
});
// make the event draggable using jQuery UI
$(this).draggable({
zIndex: 999,
revert: true, // will cause the event to go back to its
revertDuration: 0, // original position after the drag
});
});