jQuery fullCalendar set background color for cell

前端 未结 4 1390
半阙折子戏
半阙折子戏 2021-01-28 04:00

I want to set background-color for cell with date 2014-10-22. I find a solution:

         date = new Date(y,m,d);
        date = $.fullCalendar.formatDate(date,          


        
4条回答
  •  [愿得一人]
    2021-01-28 04:18

    Try this:

    var $calendar = $('#calendar').fullCalendar({
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,basicWeek,basicDay'
        },
    
        defaultView: 'month',    
        dayRender: function (date, cell) {
             date = new Date();
             date = $.fullCalendar.formatDate(date, 'yyyy-MM-dd');
             $('.fc-day[data-date="'+ date +'"]').addClass('cellBg');
        }
    });
    

    see Fiddle

提交回复
热议问题