Adding nice colors to events in FullCalendar (jquery)

戏子无情 提交于 2019-12-06 02:46:20

问题


In my calendar I want to colour each event in a different colour. Is there currently a way to send to the full calendar, in the JSON it expects a value for a colour?
FullCalendar


回答1:


Seems I missed it the first time I read the manual:

I send for each day the following JSON:

{"id":"1",
"start":"1272513600",
"end":"1272513600",
"allDay":"1",
"title":"Repeat 1,Day 1",
"className":"eventColorX"}

The important thing is the className and where the X is a number (depends on the CSS, see below).
And then in the CSS:

.eventColor1,
.fc-agenda .eventColor1 .fc-event-time,
.eventColor1 a {
    background-color: green; /* background color */
    border-color: green;     /* border color */
    color: yellow;           /* text color */
    }

.eventColor2,
.fc-agenda .eventColor2 .fc-event-time,
.eventColor2 a {
     background-color: purple; /* background color */
     border-color: purple;     /* border color */
     color: white;           /* text color */
     }


.
.
.
.



回答2:


This is now deprecated - for each event you should pass through the color and the font color. http://arshaw.com/fullcalendar/docs/event_data/Event_Object/#color-options



来源:https://stackoverflow.com/questions/2760837/adding-nice-colors-to-events-in-fullcalendar-jquery

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