Javascript 如何在 FullCalendar 中设置当前日期颜色?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4769707/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 14:00:02  来源:igfitidea点击:

How to set the current day color in FullCalendar?

javascriptjquerycssfullcalendar

提问by Kirrilian

I would like to change the color of the current day but only when the calendar is in the day agenda view. My users say they're having a hard time seeing the lines or something. I looked through the documentation as well as the css/js and didn't find a quick way of doing it. Is this even possible without major code changes?

我想更改当天的颜色,但仅当日历处于日议程视图中时。我的用户说他们很难看到线条或其他东西。我查看了文档以及 css/js 并没有找到一种快速的方法。如果没有重大代码更改,这甚至可能吗?

回答by polarblau

I honestly don't really know what you're talking about, but the jQuery UI fullcalendarwidget uses the CSS class .fc-todayto style the current day. If your changes aren't visible, try to use !important—?it might be that one of the many other classes overrides your styles elsewhere.

老实说,我真的不知道你在说什么,但jQuery UI fullcalendar小部件使用 CSS 类.fc-today来设置当天的样式。如果您的更改不可见,请尝试使用!important—? 它可能是许多其他类之一在其他地方覆盖了您的样式。

回答by Sunny Luthra

you can use following code

您可以使用以下代码

.fc-today {
    background: #FFF !important;
    border: none !important;
    border-top: 1px solid #ddd !important;
    font-weight: bold;
} 

回答by Brant

If you aren't using a theme, this worked for me using FullCalendar 2.3.1

如果您没有使用主题,这对我使用 FullCalendar 2.3.1 有效

.fc-unthemed .fc-today {
  background: ....;
}

回答by Kai Noack

I had multiple calendars so this worked:

我有多个日历所以这有效:

#calendar .fc-today {
    background: #FFF !important;
}

#calendar-two .fc-today {
    background: #FFF !important;
}

Using #calendar-favorite .fc-unthemed .fc-today { ... }did not work, so remember to remove the .fc-unthemedpart.

使用#calendar-favorite .fc-unthemed .fc-today { ... }不起作用,因此请记住移除该.fc-unthemed部分。

Also check out the jquery way: https://stackoverflow.com/a/17930817/1066234using dayRender

另请查看 jquery 方式:https: //stackoverflow.com/a/17930817/1066234使用dayRender

回答by Rams Kannan

To change color/background of fullcalendar's current day in dayview, add the following CSS class and make sure it is loaded after all css styles.

要在 dayview 中更改 fullcalendar 当天的颜色/背景,请添加以下 CSS 类并确保在所有 css 样式之后加载它。

  .fc-view-basicDay .fc-today {
     color:....;
     background:....;
  } 

回答by kneidels

for me it was .ui-state-highlight.fc-today

对我来说是 .ui-state-highlight.fc-today

回答by Fellipe Fonseca

This work for me in FullCalendar 3.6.1

这对我来说在 FullCalendar 3.6.1

#calendar-id .fc-widget-content:not(.fc-axis) {
       background: #FFF !important;
}