JS Fullcalendar background color not setting

家住魔仙堡 提交于 2019-12-11 12:24:27

问题


I am trying to set the background color of an event with FullCalendar JS http://arshaw.com/fullcalendar/

Here is my JS:

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

And here is what that produces

Why is it not producing the result I want, the event background colored as red.


回答1:


You can change the backgroundColor property for your events like:

$('#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'
    },
    ...
});

For the other dates, just use the .fc-future and .fc-today CSS properties :

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

Updated :

$('#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'
    }  
]


来源:https://stackoverflow.com/questions/25174724/js-fullcalendar-background-color-not-setting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!