是否可以限制FullCalendar那么在创建事件拖拽的时候,事件不会跨过其他日子吗?
我的意思是:如果我在 3 月 20 日 09:00 开始选择,我希望用户不能选择在 3 月 21 日 13:00 结束的事件。
最佳答案
您可以添加 eventConstraint到您的日历设置。
eventConstraint:{
start: '00:00', // a start time (start of the day in this example)
end: '24:00', // an end time (end of the day in this example)
},
你可以复制它in this plunker .
如果你只想在拖动过程中限制它,我认为你只能使用 eventDrop callback 来做到这一点.如果 moment.startOf('day),您可以在那里使用 revertFunc 将拖放移动恢复到之前的状态。是不同的。
类似于:
$('#calendar').fullCalendar({
events: [
// events here
],
editable: true,
eventDrop: function(event, delta, revertFunc) {
if (!event.start.startOf('day').isSame(event.end.startOf('day'))) {
revertFunc();
}
}
});
关于javascript - 如何将全日历事件限制为只有一天?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29167697/