本文介绍了更改FullCalendar的日子背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用在我的asp.net应用程序。有四个 ASP:按钮 S IN下面我的应用程序

I'm using FullCalendar in my asp.net application. There are four asp:Buttons in my application as below.

Weekends
Weekdays
Month
Year

在对周末按钮用户点击,我需要改变当前的月份周末天的背景颜色。

When user click on Weekends button, i need to change the background color of Weekend days of current month.

在对平日按钮用户点击,我需要改变当月平日的背景颜色。

When user click on Weekdays button, i need to change the background color of Weekdays of current month.

在对按钮用户点击,我需要改变的背景颜色当月所有日子

When user click on Month button, i need to change the background color of all days of current month.

在对年度用户点击按钮,我需要改变的背景颜色本年度的所有日子

When user click on Year button, i need to change the background color of all days of current year.

我有什么到目前为止已经试过:

下面是改变背景颜色的周末。周末的这种改变背景颜色,包括其他月份这是目前显示在日历。但我只需要改变目前的月周末只背景颜色。

Here is the Demo for change background color for weekends. this change background color of weekends including other months which are currently display on calendar. but i need to change only current months weekends background color only.

我怎样才能做到这一点?

How can i achieve this ?

推荐答案

您在您的演示几乎没有。你只需要过滤掉的日子,在其他月份 - 幸运的是FullCalendar标志着CSS类那些日子 FC-其他个月

You are almost there in your demo. You just need to filter out the days that are in other months - and luckily FullCalendar marks those days with the CSS class fc-other-month.

通过稍微改变这里的code是你如何能在周末做:

By changing your code slightly here's how you could do it for weekends:

$('#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一个更新的演示:

And an updated demo on jsfiddle: http://jsfiddle.net/z8Jfx/22/

这篇关于更改FullCalendar的日子背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 23:08