我遇到了问题beforeShowDay.
当我的页面加载时,直到我点击日历中的一天,我突然显示的日期才会突出显示.此外,如果我单击下个月按钮并返回原始月份,则"选定"日期将按预期突出显示.
因此,只有在日历的初始绘制时,日期才会突出显示,因为我已经编程了它们.日历中的任何点击都会自行修复.
我错过了一个init选项吗?请参阅下面的代码示例.我的测试网址在受保护的目录中,用户/测试/测试通过.看看右栏底部的迷你卡.切换到下个月,然后回来查看我的问题.请注意5月份突出显示的日期.此外,请注意,在发生点击之前,"年份"下拉列表也会丢失.
http://www.urbanbands.com/dev/cgi-bin/links/eventmgr.cgi?do=list
代码:
<script>
$(document).ready(function(){
// get the current date
var today = new Date();
var m = today.getMonth(), d = today.getDate(), y = today.getFullYear();
// Need list of event dates for THIS month only from database.
// Declare 'dates' var before adding "beforeShowDay" option to the datepicker,
// otherwise, highlightDays() does not have the 'dates' array.
dates = [];
fetchEventDays(y, m+1);
$('#datepicker').datepicker({
dateFormat: 'yy-mm-dd',
changeMonth: true,
changeYear: true,
setDate: today,
inline: false
});
$('#datepicker').datepicker('option', …Run Code Online (Sandbox Code Playgroud)