1

我在我的 asp.net 应用程序中使用FullCalendar 。我的应用程序中有四个asp:Button如下。

Weekends
Weekdays
Month
Year

当用户单击Weekends按钮时,我需要更改Weekend days当前月份的背景颜色。

当用户单击Weekdays按钮时,我需要更改Weekdays当前月份的背景颜色。

当用户单击Month按钮时,我需要更改all days当前月份的背景颜色。

当用户单击Year按钮时,我需要更改当年的背景颜色all days

到目前为止我已经尝试过:

这是周末更改背景颜色的演示。这会改变周末的背景颜色,包括当前显示在日历上的其他月份。但我只需要更改当前月份周末的背景颜色。

我怎样才能做到这一点?

4

1 回答 1

2

你的演示几乎就在那里。您只需要过滤掉其他月份的日子——幸运的是 FullCalendar 用 CSS 类标记了这些日子fc-other-month

通过稍微更改您的代码,您可以在周末这样做:

$('#weekends').click(function() {

    $('.fc-day.fc-sat').not('.fc-other-month').css('backgroundColor','#bce8f1');
    $('.fc-day.fc-sun').not('.fc-other-month').css('backgroundColor','#bce8f1');

});

以及关于 jsfiddle 的更新演示:http: //jsfiddle.net/z8Jfx/22/

于 2013-07-30T17:44:13.793 回答