FullCalendar:检测调整大小是在开始还是结束。 [英] FullCalendar: Detect if resize was on Start or on End.
本文介绍了FullCalendar:检测调整大小是在开始还是结束。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用FullCalendar库来建立时间表。我已经启用了可编辑
属性,所以我可以调整事件大小。我使用这个事件监听器来做我想做的事情:
I'm using FullCalendar libraries to build a schedule. I have enabled editable
attribute, so I can resize the events. I use this event listener to do what I want to do:
eventResize: function(event,dayDelta,minuteDelta,allDay,revertFunc) {
//Some code goes here
}
但我想知道是否有办法检测调整大小是发生在事件的开始日期还是结束日期?
But I want to know if there is a way to detect if the resize took place at the Start date of the event, or at the End date?
推荐答案
好吧,我自己找到了解决方案。我们可以在 eventResizeStart
和 eventResizeStop
上保留事件期间的记录,然后比较这些记录。我的意思是这样的:
Well, I found the solution by myself. We can just keep records for the event period on eventResizeStart
and eventResizeStop
and then we compare these records. I mean something like this:
eventResizeStart: function(event) {
startDateOnStart = event.start;
endDateOnStart = event.end;
}
然后
then
eventResizeStop: function(event) {
// I added 1 sec delay because in my experience the event object needs some time to update.
setTimeout(
function(){
startDateOnStop = event.start;
endDateOnStop = event.end;
//Now let's compare the dates.
if (startDateOnStart != startDateOnStop){
alert ('The resize took place at Start!');
// Do some things here.
} else if (endDateOnStart != endDateOnStop ){
alert ('The resize took place at End!');
}
}, 1000);
}
这篇关于FullCalendar:检测调整大小是在开始还是结束。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文