【问题标题】:JS Fullcalendar background color not settingJS Fullcalendar背景颜色未设置
【发布时间】:2014-08-07 13:37:45
【问题描述】:

我正在尝试使用 FullCalendar JS http://arshaw.com/fullcalendar/ 设置事件的背景颜色

这是我的 JS:

<script>
$('#calendar').fullCalendar({
    events: [
        {
            title: 'Test',
            start: '2014-08-07',
            url: '#',
            backgroundColor: '#FF0000',
            editable: true
        },
    ]
});
</script>

这就是产生的结果

为什么它没有产生我想要的结果,事件背景颜色为红色。

【问题讨论】:

    标签: javascript jquery fullcalendar


    【解决方案1】:

    您可以更改事件的 backgroundColor 属性,例如:

    $('#calendar').fullCalendar({
        {
          title: '1',
          start: new Date(2014, 02, 25, 10, 30),
          allDay: false,
          editable: false,
          backgroundColor: '#ED1317'
        },
        {
          title: '2',
          start: new Date(2014, 02, 26, 10, 30),
          allDay: false,
          editable: false,
          backgroundColor: '#ED1317'
        },
        ...
    });
    

    对于其他日期,只需使用 .fc-future 和 .fc-today CSS 属性:

    .fc-future,
    .fc-today {
        background-color: #10CC55;
    }
    

    更新:

    $('#calendar').fullCalendar({
    eventSources: [        
        {
            events: [ 
                {
                    title  : 'event1',
                    start  : '2010-01-01'
                },
                {
                    title  : 'event2',
                    start  : '2010-01-05',
                    end    : '2010-01-07'
                },
                {
                    title  : 'event3',
                    start  : '2010-01-09 12:30:00',
                }
            ],
            backgroundColor: '#ED1317'
        }  
    ]
    

    【讨论】:

    • 不幸的是,我仍然得到与上面相同的结果。
    • 只是一些弃用警告,这些不应该影响任何事情gyazo.com/d3174dde79bd11b49401dde748e43af1
    • 仍然产生相同的结果
    • 尝试修改后的代码,尝试仅在更新部分将 backgroundColor 替换为 Background-Color。
    • 谢谢!我很感激!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多