Disable highlight of an external event in fullcalendar

丶灬走出姿态 提交于 2020-01-01 19:51:07

问题


I am using the fullcalendar jquery plugin v2.6.1. Actually, I want to prevent the highlighted option of an external events while dragging to the calendar.

Is there any possible way to disable the fc-highlight from the event or any option to show the highlight on the basis of event size. I mean to say that I have an external event with start and end time e.g the event starts from 10:00 and ends at 11:00 but when I'm dragging that event to the calendar, the fc-highlight always covered the two hours slot.

Picture attached below

So in the picture, the grayish highlighted box in red stroke Event 2 which is only available for one hour slot but the highlighted background covers two hours which I want to disable it or just make it one hour. Please help.

Thanks in advance!


回答1:


You can achieve the solution by adding defaultTimedEventDuration: 01:00:00 in FullCalendar options or adding duration in an external events, something like this:

<div class="external fc-event" duration="04:00">Event</div>



回答2:


I'm not sure but if you will set end time in drop function for the external event then you don't need to disable the highlight. Try this:

var eventsArray = [];

$('#calendar').fullCalendar({

    drop: function(date) {

        var eventObject = $(this).data('eventObject');

        var eventObjectDuplicate = $.extend({}, eventObject);

        eventObjectDuplicate.start  = date;
        eventObjectDuplicate.end    = (date.getTime() + 1800000)/1000;
        eventObjectDuplicate.allDay = false;

        eventsArray.push(eventObjectDuplicate);

    }

)};


来源:https://stackoverflow.com/questions/43573734/disable-highlight-of-an-external-event-in-fullcalendar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!