使用Fullcalendar插件中的事件修改一天的背景颜色

时间:2014-08-19 13:20:51

标签: events colors calendar fullcalendar

我需要更改通过Google日历添加活动的特定日期的背景颜色。

我删除了它最初显示事件的方式,就像您可能知道的那样,就像在日历中一样,因为我不需要它。
我还想过在某种程度上在源代码中添加一个条件来检查当天是否有事件,如果条件为真,则添加一个特殊类,如fc-has-event,然后通过CSS规则修改它。但问题是我不知道如何做到这一点,我已经花了两天时间检查代码。

有人能帮帮我吗?

1 个答案:

答案 0 :(得分:0)

eventRender内使用Date构造函数将事件日期与手动设置日期进行比较:

var google_date = new Date( event._start._d );
var check_date = new Date( '2014-09-09' ); // The date you want to highlight
if ( google_date.toDateString() == check_date.toDateString() ) {
   element.addClass( 'custom-class' );
}