This seems incredibly easy, but I have spent half a day bashing my head against the wall trying to figure out why my fullcalendar events are showing only at 77px, when the width of the cell(month view) seems to be either 90px or higher. I have tried modifying the fc-event css rule, but it seems like javascript is writing some inline styles into the calendar, overwriting these styles.
I can't seem to find out where these styles are getting written!
Can anyone who has customized fullcalendar give some insight? It is running as a page on a wordpress blog, not sure if this has anything to do with it, as I noticed that one of the buttons is lopped off at an awkward position.
Here is an example of how to specify an array of events: var calendar = new Calendar(calendarEl, { events: [ { title : 'event1', start : '2010-01-01' }, { title : 'event2', start : '2010-01-05', end : '2010-01-07' }, { title : 'event3', start : '2010-01-09T12:30:00', allDay : false // will make the time show } ] });
If "auto" is specified, the view's contents will assume a natural height and no scrollbars will be used. If "100%" is specified, the height of the calendar will match the height of its parent container element. See an example. Any other valid CSS value is accepted as well.
although it is not specified on the fullcalender site, it is necessary to assign a value to the "allday" parameter to be able to add new events dynamically. If you set this value to "false", it will not add the event to the AllDay row. If you do "true" it will add to the AllDay row. Save this answer.
The calendar's dates can change any time the user does the following: click the prev/next buttons, change the view, click a navlink. The dates can also change when the current-date is manipulated via the API, such as when gotoDate is called. datesSet is called after the new date range has been rendered.
you can set event width with eventAfterRender
$('#calendar').fullCalendar({
eventAfterRender: function(event, element, view) {
$(element).css('width','50px');
}
});
I've used !important to override the inline style and it worked fine
.fc-event{
width: 98px !important;}
eventRender: function (event, element, view) {
if (event.eventType == "Task") { //own property
var one_day = 1000 * 60 * 60 * 24;
var _Diff = Math.ceil((event.start.getTime() - view.visStart.getTime()) / (one_day));
var dayClass = ".fc-day" + _Diff;
if (event.days == 1) { //own property
jQuery(dayClass).addClass("one-day-event"); //set width to 90px (cca 2 cells)
} else {
jQuery(dayClass).removeClass("one-day-event");
}
view.setWidth(jQuery(dayClass).css("width") * event.days);
}
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With