Search code examples
cssfullcalendarcellbackground-color

Fullcalendar: Change the color for specific days


I'm stuck with a project I get at work. I need to change the background color of some days. It's a calendar where the user should see, which days are available and which not. I found out that there is an attribute called "data-date", but I didn't found a possibility to use it.

Is there any way to manipulate the background of specific days?

I think there must be a way, cause the cell which shows the current date has another color too.


Solution

  • For the views month, basicWeek and basicDay you can change the rendering of the days by providing a dayRender function. E.g.:

    $("#calendar").fullCalendar({
        dayRender: function (date, cell) {
            cell.css("background-color", "red");
        }
    });
    

    The documentation for dayRender is available here: http://arshaw.com/fullcalendar/docs/display/dayRender/

    And here's a working example on jsfiddle: http://jsfiddle.net/kvakulo/CYnJY/4/