这是我的完整日历实现:
$(renderTo).fullCalendar({
timeFormat: 'HH:mm',
axisFormat: 'HH:mm',
defaultView:view,
firstHour: 7,
firstDay: 1,
titleFormat: {
month: 'MMMM yyyy',
week: "MMM d[ yyyy]{ '—'[ MMM] d yyyy}",
day: 'dddd, d MMM yyyy',
},
columnFormat: {
month: 'ddd',
week: 'ddd, dd.MM',
day: 'dddd, dd.MM'
},
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
buttonText: {
prev: '<',
next: '>',
prevYear: '«',
nextYear: '»',
today: 'dziś',
month: 'miesiąc',
week: 'tydzień',
day: 'dzień'
},
monthNames: ['Styczeń', 'Luty', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'Październik', 'Listopad', 'Grudzień'],
monthNamesShort: ['Sty', 'Lut', 'Mar', 'Kwi', 'Maj', 'Cze', 'Lip', 'Sie', 'Wrz', 'Paź', 'Lis', 'Gru'],
dayNames: ['Niedziela', 'Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota'],
dayNamesShort: ['Nie', 'Pon', 'Wto', 'Śro', 'Czw', 'Pią', 'Sob'],
editable: true,
eventDrop: function(event,dayDelta,minuteDelta,allDay,revertFunc) {
result = updateEvent(event.id,dayDelta,minuteDelta,allDay,'false');
if (result == true) {
} else {
revertFunc();
alert(result);
}
},
eventMouseover: function( event, jsEvent, view ) {
var details = getDetails(event.id, $(this));
},
eventResize: function(event,dayDelta,minuteDelta,revertFunc) {
result = updateEvent(event.id,dayDelta,minuteDelta,'false','true');
if (result == true) {
//alert('Zmiana została zapisana');
} else {
revertFunc();
alert(result);
}
},
droppable: true, // this allows things to be dropped onto the calendar !!!
drop: function(date, allDay) {
var originalEventObject = $(this).data('eventObject');
var copiedEventObject = $.extend({}, originalEventObject);
copiedEventObject.start = date;
copiedEventObject.allDay = allDay;
//$time
result = addNewEvent(copiedEventObject.start.toISOString(),originalEventObject.title,originalEventObject.allDay);
if (result == true) {
var currentView = $(renderTo).fullCalendar('getView');
renderCalendar(renderTo,currentView.name);
} else {
alert(result);
}
},
events: {
url: '/schedule/getCalendarEvents',
data: {
agent_id: <?php echo $this->user_info->id; ?>,
},
error: function() {
alert('Wystąpił problem w czasie pobierania danych!');
},
//color: 'yellow', // a non-ajax option
textColor: 'black' // a non-ajax option
},
loading: function(bool) {
if (bool) $('#loading').show();
else $('#loading').hide();
}
});
我想删除这个 div:
<div class="external-event ui-draggable" style="position: relative;background-color:red">sdf</div>
丢弃 div 事件时如何动态更改背景颜色
所以在这个例子中我想要新的事件 bg-color:red