Fullcalendar: Change the color for specific days

前端 未结 8 957
伪装坚强ぢ
伪装坚强ぢ 2020-12-08 16:31

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 n

8条回答
  •  粉色の甜心
    2020-12-08 16:55

    If any one want to jquery fullcalendar previous all day red(or any other) colored then this is the code.

        var $calendar = $('#calendar').fullCalendar({
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,basicWeek,basicDay'
        },
    
        defaultView: 'month',
    
        dayRender: function (date, cell) {
           var check = $.fullCalendar.formatDate(date,'yyyy-MM-dd');
                        var today = $.fullCalendar.formatDate(new Date(),'yyyy-MM-dd');
                        if (check < today) {
                            cell.css("background-color", "red");
                        }
        }
    });
    

    Regin Larsen code help me achive this. Thanks Regin Larsen.

提交回复
热议问题