我具有自定义的slotDuration
和slotLabelInterval
选项,因为我需要在一天中显示事件。但是,当我设置这些选项时,Fullcalendar不会在周末增加fc-sat
和fc-sun
类。无论如何我如何突出显示它们?
firstDay: 1,
slotWidth: 22,
slotDuration: '12:00',
slotLabelInterval: '24:00',
slotLabelFormat: [{ weekday: 'short', day: 'numeric' }],
我发现了一个肮脏的解决方法,但它可以工作。想法是通过标题中的日期名称选择span.fc-cell-text
(在示例中使用捷克的日期名称),然后由其父项th.fc-widget-header
获得其日期的日期值,然后仅添加一个类来突出显示整个列那个日期。因为一天之间相隔12个小时,所以也需要用T00:00:00
和T12:00:00
时间突出显示日期。
$('span.fc-cell-text:contains("so "), span.fc-cell-text:contains("ne ")').each(function() {
var date = $(this).parents('.fc-widget-header').data('date');
$('td[data-date="' + date + '"], td[data-date="' + date.replace('T00:00:00', 'T12:00:00') + '"]').addClass('fc-sat');
});
我想到的另一种解决方案是在周末的服务器端脚本中找到,但这实现起来更容易,更快捷。