简体   繁体   English

一天的jQuery UI Datepicker更改样式

[英]JQuery UI Datepicker Change Style for a Day

I'm writing a simple script. 我正在写一个简单的脚本。

I read from a database non-working days, and I'd like to change the background/font color for these days. 我在非工作日从数据库中读取数据,因此我想更改这几天的背景/字体颜色。 When I click a day, I toggle it background/font color. 单击一天时,将其切换为背景/字体颜色。

With non-working days, I'm not saying weekends, but mid-week days that are non-working, because of national holidays . 在非工作日中,我并不是说周末,而是由于国定假日而处于非工作日。

How could I modify specific days in datepicker? 如何修改日期选择器中的特定日期? Is this possible? 这可能吗? May I design and code a custom calendar? 我可以设计和编写自定义日历吗?

Thanks 谢谢

This has been asked before, I think this (along with the fiddle) answers your question: 之前有人问过这个问题,我想这(和小提琴一样)回答了您的问题:

jQuery UI datepicker: How to color sundays red? jQuery UI datepicker:如何将星期日涂成红色?

Datepicker has a .ui-datepicker-week-end element that you can use to change the background/font accordingly. Datepicker具有.ui-datepicker-week-end元素,可用于相应地更改背景/字体。 An example given in the above is: 上面给出的示例是:

.ui-datepicker-week-end a {
    background-image: none;
    background-color: red;
}

If you want to set the color property instead of background-color, you will indeed have to use !important: 如果要设置color属性而不是background-color,则必须使用!important:

.ui-datepicker-week-end a {
    color: red !important;
}

Adding answer specifically for changing bank holiday dates for future reference. 添加专门用于更改银行假期日期的答案,以供将来参考。 This is a nice step by step guide. 这是一个不错的逐步指南。

http://www.jquerybyexample.net/2012/05/highlight-specific-dates-in-jquery-ui.html http://www.jquerybyexample.net/2012/05/highlight-specific-dates-in-jquery-ui.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM