更改日期选择器上特定日期单元格背景颜色的正确方法
我在网上看到了很多答案 如何更改 jquery 日期选择器的单元格颜色 但由于某种原因,它们不适用于我的示例。
http://plungjan.name/test/datepicker_orange.html
我希望将整个单元格内容是橙色的,不仅仅是我们在单元格中的链接后面可以看到的
所以我可以看到
.ui-state-default {
background: url("images/ui-bg_glass_75_e6e6e6_1x400.png") repeat-x scroll 50% 50% #E6E6E6;
border: 1px solid #D3D3D3;
color: #555555;
font-weight: normal;
}
它控制单元格内的链接,其类名由我设置为“橙色”,
<td class=" orange" onclick="DP_jQuery_1327604402271.datepicker._selectDay('#toDate',1,2012, this);return false;" title="Almost sold out">
<a class="ui-state-default" href="#">15</a>
</td>
其中橙色类是我在这段代码中给出的:
return [true,"orange","Almost sold out"];
它显示
而不是
如果我在 firebug 中删除上述 ui-state-default 的背景图像,我可以获得什么?
更改我现在使用 beforeShowDay 更改的单元格的完整单元格颜色的正确方法是什么?
我尝试通过覆盖默认值来帮助解决问题:
.ui-state-default {
background-color: transparent;
border: 1px solid #D3D3D3;
color: #555555;
font-weight: normal;
}
没有任何区别
I have seen many answers on the line of
How to change the cell color of a jquery datepicker
But they for some reason do not apply to my example.
http://plungjan.name/test/datepicker_orange.html
I want the WHOLE cell content to be orange, not just what we can see behind the link IN the cell
So what I can see as
.ui-state-default {
background: url("images/ui-bg_glass_75_e6e6e6_1x400.png") repeat-x scroll 50% 50% #E6E6E6;
border: 1px solid #D3D3D3;
color: #555555;
font-weight: normal;
}
which controls the link inside the cell with a class name set by me to "orange"
<td class=" orange" onclick="DP_jQuery_1327604402271.datepicker._selectDay('#toDate',1,2012, this);return false;" title="Almost sold out">
<a class="ui-state-default" href="#">15</a>
</td>
where the orange class is given by me in this code:
return [true,"orange","Almost sold out"];
It shows
and not
Which I can get if I remove the background image of the above ui-state-default in firebug
What is the correct method of changing the complete cell color of the cells I now change using the beforeShowDay?
I tried helping the situation by overriding the default:
.ui-state-default {
background-color: transparent;
border: 1px solid #D3D3D3;
color: #555555;
font-weight: normal;
}
Did not make any diffence
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
@mplungjan 将 css 更改为:
@mplungjan Change css to this:
如果你把你的类直接放在标签上,你必须将其更改为:
在 CSS 中,如果你有背景图像和背景颜色,那么浏览器将向你显示图像,在本例中是你在第一个例子。
If you put your class directly on the tag you have to change it to this:
In CSS if you have a backgorund image and a background color then the browser will show you the image which in this case is that gradient grey that you have in the first example.