FullCalendar和多个事件源

use*_*122 4 jquery fullcalendar

我有几个json feed,我想在日历上显示.

看看文档似乎有一些解释,但没有超过1个json feed的例子.

我有以下内容:

var source = Array();
source[0] = '/feed1.php';
source[1] = '/feed2.php';
eventSources: [
  source[0],
  source[1]
]
Run Code Online (Sandbox Code Playgroud)

这显示事件很好,我可以在我的日历上看起来

但是我如何在颜色方面区分它们呢?

谢谢

Bri*_*ter 10

您可以使用扩展形式的事件源为每个源提供自己的颜色.在下面的代码中,"color"是事件背景颜色,"textColor"是事件文本的颜色.

$('#calendar').fullCalendar({
  header: {
    left: 'prev,next',
    center: 'title',
    right: 'today'
  },

  eventSources: [
    {
      url: '/feed1.php',
      color: 'yellow',
      textColor: 'black'
    },
    {
      url: '/feed2.php',
      color: 'blue',
      textColor: 'white'
    }
  ]
});
Run Code Online (Sandbox Code Playgroud)

这是一个使用这种方法的JSFiddle:http://jsfiddle.net/emcw5/4/.