在arshaw fullcalendar中突出显示日期

时间:2013-05-27 11:16:20

标签: javascript fullcalendar

我正在使用arshaw fullcalendar api来渲染日历。 现在我知道今天突出了。同样我有一个日期列表,我想在周视图中突出显示。日期可以在不同的星期。 任何帮助表示赞赏。谢谢。

2 个答案:

答案 0 :(得分:2)

对于agendaWeek和agendaDay视图,可以通过更改fullcalendar.js文件来实现。

将另一个参数传递给fullcalendar,再说highlightDays

highlightDays: [0,3,4]   // List of days to highlight  0 - Sunday ... 6 - Saturday

在fullcalendar.js中updateCells()方法

if(opt('highlightDays').indexOf(date.getDay()) > -1)
{
    bodyCell.removeClass('ui-widget-content');
    bodyCell.addClass('fc-day-highlight');
}

在fc-day-highlight css类中添加您想要的颜色为

background-color: #dddddd; 

答案 1 :(得分:1)

嗨,您可以在viewDisplay回调中使用一点hack渲染自定义高亮显示:

viewDisplay : function( view ) { 

            startDate = view.start;

                var d = startDate.getDate();
                var m = startDate.getMonth();
                var y = startDate.getFullYear();

            cols = $('.fc-view-agendaWeek [class*="fc-col"].fc-widget-content')    

            for(i = 0 ; i<  cols.length ; i++){

                var colDate = new Date(y, m, d+i);


                if($.inArray(colDate.getTime() , hightligthedDays) > -1){

                    $(cols[i]).addClass("fc-state-highlight-other");

                   }
                else{

                    $(cols[i]).removeClass("fc-state-highlight-other");

                }
            }

            }

jsfiddle