使用 FullCalendar 获取事件数据时设置自定义颜色似乎不起作用
Setting custom colors when fetching events data using FullCalendar does not seem to work
我正在使用 FullCalendar JQuery 插件并通过简单的事件数组获取事件数据。这很好用,但是,我似乎无法为这些事件设置自定义颜色。我已经按照官方文档进行操作。我究竟做错了什么?我正在尝试将 'color' 和 'textColor' 选项设置为黄色和黑色,如下所示:
$('#calendar').fullCalendar(
{
events: [
{
title: 'Event1',
start: '2015-05-04'
},
{
title: 'Event2',
start: '2015-05-05'
}
],
color: 'yellow', // an option!
textColor: 'black' // an option!
}
)
但是,当您访问 demo link here, you can see that it does not take effect. Can someone point me in the right direction? The official documentation about doing this method is here.
http://fullcalendar.io/docs/usage/ 状态:
The above code should be in a tag in the head of your page
您是否尝试过将 <script />
代码移动到页面的头部?目前,它位于您的日历下方。
我在本地试过了,没问题...
$('#calendar').fullCalendar(
{
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
eventSources: [
{
events: [ // put the array in the `events` property
{
title : 'event1',
start : '2015-05-01'
},
{
title : 'event2',
start : '2015-05-05',
end : '2015-05-07'
},
{
title : 'event3',
start : '2015-05-09T12:30:00',
}
],
color: 'yellow', // an option!
textColor: 'black' // an option!
}
// any other event sources...
],
});
我正在使用 FullCalendar JQuery 插件并通过简单的事件数组获取事件数据。这很好用,但是,我似乎无法为这些事件设置自定义颜色。我已经按照官方文档进行操作。我究竟做错了什么?我正在尝试将 'color' 和 'textColor' 选项设置为黄色和黑色,如下所示:
$('#calendar').fullCalendar(
{
events: [
{
title: 'Event1',
start: '2015-05-04'
},
{
title: 'Event2',
start: '2015-05-05'
}
],
color: 'yellow', // an option!
textColor: 'black' // an option!
}
)
但是,当您访问 demo link here, you can see that it does not take effect. Can someone point me in the right direction? The official documentation about doing this method is here.
http://fullcalendar.io/docs/usage/ 状态:
The above code should be in a tag in the head of your page
您是否尝试过将 <script />
代码移动到页面的头部?目前,它位于您的日历下方。
我在本地试过了,没问题...
$('#calendar').fullCalendar(
{
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
eventSources: [
{
events: [ // put the array in the `events` property
{
title : 'event1',
start : '2015-05-01'
},
{
title : 'event2',
start : '2015-05-05',
end : '2015-05-07'
},
{
title : 'event3',
start : '2015-05-09T12:30:00',
}
],
color: 'yellow', // an option!
textColor: 'black' // an option!
}
// any other event sources...
],
});