简体   繁体   中英

Is it possible to color days numbers in fullcalendar.js?

So I am using fullcalendar.js and I have events rendered with different colors. The problem is that some events are rendered with black (that means the background color of the cells is black) and I would like now to modify the color of the days numbers for the event (dynamically, so for black events -> white, for white events -> black).

NB: 1. I don't want to modify the event text color.
2. I have tried using eventRender( event, element, view ) callback but the 'element' div is different from the div containing the day number.

在此处输入图片说明

Depending on the version you are using you should be able to use one of these options:

  1. You need to figure out the first visible day (using the view parameter or the callback you mention) then use this to figure out the number of days between this date and the event date. With this you can use the class "fc-day0" to key off (replace 0 with the value you calculated)
  2. In newer versions you could use the data attribute "data-date" to select the correct element

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM