设置Fullcalendar单元格背景颜色 [英] Setting Fullcalendar Cell Background Color

查看:2052
本文介绍了设置Fullcalendar单元格背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到几个主题如何设置一个单元格的fullcalendar的背景颜色,但没有一个为我工作。我想用日历来列出天使用他们的日期,如.fc-day5或.fc-day17,但在1.6.2版本不再。

I saw several topics on how to set the background color of a cell in fullcalendar, but none of them worked for me. I guess the calendar used to list the days using their date as such .fc-day5 or .fc-day17, but in version 1.6.2 it doesn't anymore.

我有一个正在渲染的几个事件的列表,我想将它们的单元格颜色(整个一天单元格,不仅是事件单元格)设置为特定的颜色。

I have a list of several events that are being rendered and I want to set their cell color (the entire day cell, not only the event cell) to a specific color.

我使用'eventRender'尝试设置类

I use 'eventRender' to try to set a class

eventRender: function (event, element, monthView) { 
                if (event.className == "holiday") {
                    $day = $date.getDate();
                    $("td.fc-day-number[value='" + $day + "']").addClass("holiday");
                }
            },

如果您对设置背景颜色。

Let me know if you have any idea on how to set the background color.

推荐答案

好吧,你可以这样做。

{
  title: 'Some title',
  start: new Date(2014, 8, 24, 10, 30),
  allDay: false,
  editable: false,
  backgroundColor: '#SomeColor',
  borderColor: '#SomeColor'
},
{
  title: 'Some title2',
  start: new Date(2014, 8, 24, 10, 30),
  allDay: false,
  editable: false,
  backgroundColor: '#SomeColor2',
  borderColor: '#SomeColor2'
}

类名如下:

{
  title: 'Teste1',
  start: new Date(y, m, d, 10, 30),
  allDay: false,
  editable: false,
  className: ["red"]
},
{
  title: 'Teste1',
  start: new Date(y, m, d, 10, 30),
  allDay: false,
  editable: false,
  className: ["green", "secondClass"]
}

/ p>

Then describe that style of class

<style>

.red {
    background-color:red;
}

.green {
    background-color:green;
}
.green{
// do something
}
</style>

这篇关于设置Fullcalendar单元格背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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