gpt4 book ai didi

javascript - jQuery 全日历 : Change the color of every saturday except last saturday in the month

转载 作者:行者123 更新时间:2023-11-29 17:52:42 25 4
gpt4 key购买 nike

目前我正在做一个元素,我在其中实现了一个 jQuery Fullcalendar。

有一些要求,例如:

  1. 更改每个星期天的颜色(因为星期天会休息)

  2. 更改所有月份中除最后一个星期六以外的每个星期六的颜色(最后一个星期六为开)

我已经使用 CSS 完成了第一个任务

.fc-sun {
background-color: #FFe5e5 !important;
}

但我一直在尝试完成第二个任务。

我试图通过谷歌搜索,但找不到如何执行此操作。

想要应用任何使用 jquery/Javascript/CSS 的解决方案。

这是 fiddle

谢谢

最佳答案

将此添加到日历选项:

viewDisplay: function(view) {
$(".fc-sun, .fc-sat").addClass("non-working-day");
$(".fc-sat:not(.fc-other-month)").last().removeClass("non-working-day");
},

这是 css:

.non-working-day{
background-color: #FFe5e5 !important;
}

解释:

viewDisplay 函数将在每次重新加载 View (例如更改月份)时调用。每次我们都需要找到该月的最后一个星期六。我们首先为所有星期六和星期日添加一个类(class),然后我们将该类(class)删除到最后一个星期六,因为它是一个工作日。

关于javascript - jQuery 全日历 : Change the color of every saturday except last saturday in the month,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41828917/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com