在Mobiscroll日历上更新标记日期

时间:2013-06-26 18:26:02

标签: mobiscroll

在Mobiscroll日历(http://mobiscroll.com/)上,您可以在初始化Mobiscroll日历时设置标记日期。有没有办法在初始化日历后更新标记日期?我似乎无法在文档中找到这样做的方法。

1 个答案:

答案 0 :(得分:0)

documentation的示例:

$(function(){
    $('#calendar').mobiscroll().calendar({
        marked: { dates: [ new Date(2013, 5, 6), new Date(2013, 5, 10) ] }, // Initially marked days
        onMonthChange: function (year, month, inst) {
            // Load marked days for (year, month), (year, month - 1), (year, month + 1)

            // Update dates only
            inst.settings.marked.dates = [ new Date(year, month - 1, 15), new Date(year, month, 15), new Date(year, month + 1, 15) ];

            // OR Update the whole marked object (only if necessary)
            inst.settings.marked = {
                dates: [ new Date(year, month - 1, 15), new Date(year, month, 15), new Date(year, month + 1, 15) ],
                daysOfMonth: ['5/1', '12/24', '12/25']
            }; 
        }
    });
});