0
我想用一个MySQL数据库使用jquery datepicker来显示任何有事件的日期。jquery datepicker css造型禁用日期
我已经设置showOtherMonths:true因为偏好。
我想要做的是设置当前月份中的禁用日期,以便它们与其他月份中的日期不同。
如何为此添加样式?
$(document).ready(function()
{
var selected_dates = new Array();
// get all the events from the database using AJAX
selected_dates = getSelectedDates();
$('#datepicker').datepicker({
dateFormat: 'yy-m-d',
inline: true,
showOtherMonths: true,
dayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
beforeShowDay: function (date)
{
// get the current month, day and year
// attention: the months count start from 0 that's why you'll need +1 to get the month right
var mm = date.getMonth() + 1,
dd = date.getDate(),
yy = date.getFullYear();
var dt = yy + "-" + mm + "-" + dd;
if(typeof selected_dates[dt] != 'undefined')
{
// put a special class to the dates you have events for so you can distinguish it from other ones
// the "true" parameter is used so we know what are the dates that are clickable
return [true, " my_class"];
}
return [false, ""];
}
});
});
你从哪里得到这些信息? – gibberish
谢谢阿伦。我只是拿出:不(.my_class),改变背景颜色,而我得到了我想要的结果。正如胡言乱语所问,你从哪里得到这些信息,因为我需要做更多的造型? – AdRock