更改已单击的特定日期的颜色

时间:2015-04-13 13:21:48

标签: javascript jquery spring-mvc

如何更改已在日历上点击的特定日期的颜色?

这是我的代码:

selectable: true,
selectHelper: true,
select: function(calEvent, jsEvent, view) { 
    var moment = $('#calendar').fullCalendar('getDate');
    /**
      * calEvent is the event object, so you can access it's properties
      */
    if(confirm("Would you like to cancel the meal delivery ?")){  
        delete event in backend
        jQuery.post("/vacation/deleteEvent", { "id": calEvent.id } );

        delete in frontend
        $(this).css('border-color', 'red'); 
    }
}, 

1 个答案:

答案 0 :(得分:0)

对于我想你正在使用的JQuery插件fullcalendar,你可以通过他的标题改变特定日期的颜色:

eventRender: function(event, element) {
    $where = event.title;
    if ($where == 'your title') 
        element.css('background-color', '#bbd2e1');
    else
        element.css('background-color', '#f0c0cb');
            }