全日历的彩色周末 [英] Color weekend at Fullcalendar

查看:22
本文介绍了全日历的彩色周末的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用FullCalendar组件,我需要为周末(星期五和星期六)上色。 我已经按照这里推荐的方式使用了以下内容: Can I set a different color for the weekend on monthly fullCalendar display

$('table.calendar > tbody > tr > td:nth-child(-n+2)').addClass('fc-weekend');

我还添加了CSS类。

这是我的代码,它不会给周末上色.任何建议!

$(document).ready(function() {
    var date = new Date();
    var d = date.getDate();
    var m = date.getMonth();
    var y = date.getFullYear();
    $.getJSON('[@spring.url '/loadSomeData'/]', function (data) {
      $.getJSON('[@spring.url '/loadOtherData/]', function (info) {
        information = returnedPublicVacation;

        var calendar = $('#calendar').fullCalendar({
          header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
          },
          selectable: true,
          selectHelper: true,
          select:
            function(start, end, allDay) {
              vacationStart = start;
              showTheCorrectDialog(vacationStart);
            },

          eventClick: function(calEvent, jsEvent, view) {

            showTheCorrectDialog(calEvent.start);

            // change the border color just for fun
            $(this).css('border-color', 'red');
          },

          editable: true,
          events:data.concat(information)
        });
        resourceVacation = data;
      });
    });

    $('table.calendar > tbody > tr > td:nth-child(-n+2)').addClass('fc-weekend');
  });

css

是否将样式添加到推荐答案文件中的类?

您也可以尝试此操作:

.fc-fri { color:blue; }
.fc-sat { color:red;  }

(周日为.fc-sun) 您可以在这里看到示例:http://jsfiddle.net/rajesh13yadav/nf9whojL/1/

这篇关于全日历的彩色周末的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆