Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FullCalendar: Customizing the calendar

I need help customizing a Full calendar display. Like changing border colors, calendar background, adding removing Month/Day/Week Views or button?

This is what I have to display the calendar:

//$('#calendar').fullCalendar()

var myCalendar = $('#calendar');
myCalendar.fullCalendar();

// Adding a Simple event
var myEvent = {
    title: "New Event Added",
    allDay: true,
    start: new Date(),
    end: new Date()
};        

myCalendar.fullCalendar('renderEvent', myEvent);
like image 661
fireholster Avatar asked Oct 01 '13 23:10

fireholster


People also ask

How do I change the date on FullCalendar?

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.

How do I change my FullCalendar theme?

It is possible to change the look of the calendar (colors, fonts, etc) by applying a theme. Renders the calendar with a given theme system. In order to correctly theme your calendar with a Bootstrap 5 theme, you must include the correct stylesheets, include the JavaScript plugin, and set themeSystem to 'bootstrap5'.

How do I set events in FullCalendar?

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 } ] });


1 Answers

You should avoid editing fullcalendar.css directly, so that you can update the CSS when the next versions are released.

To customize the look of FullCalendar, create a fullcalendar-custom.css file, which you can use to override specific styles. Just include this custom file somewhere after the fullcalendar.css, i.e.:

<link href="../fullcalendar/fullcalendar.css" rel="stylesheet">
<link href="../fullcalendar/fullcalendar-custom.css" rel="stylesheet">

To figure out what styles you need to override, you should use inspect element in your browser to figure out which classes need to be modified.


You can remove/modify the "Month/Day/Week" view buttons when initializing FullCalendar.

For example, you could do this:

myCalendar.fullCalendar({
    header: {
        left: 'prev,next today title',
        right: 'month,agendaDay'
    }
});

For more info, see the documentation for header and available views.

like image 115
nomatteus Avatar answered Sep 27 '22 01:09

nomatteus