在日历中的特定日期后更改背景颜色 [英] Changing Background color after a particular date in calendar

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

问题描述

我有一个活动日历。我想更改特定日期[SOC DATE]后所有列的背景颜色为绿色和红色日期后。我的日历如下。

I have a event calendar.I want to change the background color of all column after a particular date [SOC DATE] to green and after the date red. My calendar is as follows.

<td class="fc-day fc-wed fc-widget-content fc-past" data-date="2014-02-19">
<td class="fc-day fc-thu fc-widget-content fc-past" data-date="2014-02-20">
<td class="fc-day fc-fri fc-widget-content fc-today fc-state-highlight" data-date="2014-02-21">
<td class="fc-day fc-sat fc-widget-content fc-future" data-date="2014-02-22">
<td class="fc-day fc-sun fc-widget-content fc-future fc-last" data-date="2014-02-23">

我设法使用以下jquery更改该日期的背景颜色[SOC DATE] p>

I managed to change the background color of that date[SOC DATE] using the following jquery.

$("[data-date=2014-02-22]").css("background-color","#ff9bd7");

但我无法更改上一个和过去日期的颜色。
我试了
$([data-date> 2014-02-22])。css(background-color,red);
但不工作。

But I cannot change the color of previous and past dateS. I tried $("[data-date>2014-02-22]").css("background-color","red"); but not working.

提前感谢。

推荐答案

您可以尝试使用 prevAll()

$("[data-date=2014-02-22]").prevAll().css("background-color","red");






请尝试以下操作:


Try this:

$("[data-date=2014-02-22]").closest('tr').prevAll('tr').find('td').css("background-color","red");






请尝试以下操作:


Try this:

var index = $("[data-date=2014-02-22]").index('td.fc-day');

$('td.fc-day:lt(' + index + ')').css("background-color","red");

这篇关于在日历中的特定日期后更改背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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