如何以全日历方式用不同的颜色更改事件的背景颜色? [英] How do I change an event's background color with different colors, in fullcalendar?

查看:364
本文介绍了如何以全日历方式用不同的颜色更改事件的背景颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是最新版本的fullcalendar,我查看了文档中如何更改背景颜色事件,但我不知道如何更改不同的事件.
我需要事件,红色,蓝色,绿色的代码示例,如下图所示:

I'm using the last version of fullcalendar, I looked on documentation how change background color event, but I don't know how make to different events.
I need for code sample with events red, blue, green, like the following picture:

我在文档站点上看到了此代码,但是我无法应用两种颜色:

I see this code, on document site, but I can't to apply 2 colors:

$('#calendar').fullCalendar({
  editable: true,
  events: [{
    title: 'Teste1',
    start: new Date(y, m, d, 10, 30),
    allDay: false,
    editable: false
  }, {
    title: 'Teste2',
    start: new Date(y, m, d, 11, 40),
    allDay: false
  }],
  eventColor: '#378006'
});

推荐答案

由于您使用的是最新版本(1.5),因此可以设置backgroundColor属性.

Since you are using the latest version (1.5), you can set the backgroundColor property.

{
  title: 'Teste1',
  start: new Date(y, m, d, 10, 30),
  allDay: false,
  editable: false,
  backgroundColor: '#SomeColor'
},
{
  title: 'Teste2',
  start: new Date(y, m, d, 11, 40),
  allDay: false,
  backgroundColor: '#SomeOtherColor'
}   

如果还需要更改textColor属性,也可以设置.

You can also set the textColor property if you need to change that as well.

这篇关于如何以全日历方式用不同的颜色更改事件的背景颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆