How to edit width of event in FullCalendar?

眉间皱痕 提交于 2019-12-01 04:45:11

you can set event width with eventAfterRender

$('#calendar').fullCalendar({
  eventAfterRender: function(event, element, view) {
                      $(element).css('width','50px');
                    }
});

I've used !important to override the inline style and it worked fine

.fc-event{ width: 98px !important;}

eventRender: function (event, element, view) {
    if (event.eventType == "Task") { //own property
        var one_day = 1000 * 60 * 60 * 24;
        var _Diff = Math.ceil((event.start.getTime() - view.visStart.getTime()) / (one_day));
        var dayClass = ".fc-day" + _Diff;

        if (event.days == 1) {  //own property
            jQuery(dayClass).addClass("one-day-event"); //set width to 90px (cca 2 cells)
        } else {
            jQuery(dayClass).removeClass("one-day-event");

        }
        view.setWidth(jQuery(dayClass).css("width") * event.days);
    }
},
user3243514

I got the result using this code and hope work fine with you too.

$('#calendar').fullCalendar({
  eventAfterRender: function(event, element, view) 
  {
      $(element).css('width','50');
  }
});

Some wordpress theme style does not play nice with fullcalendar. I am using Wordpress 3.0, using the style Twenty Ten. Instead of inserting it inside the content div, I inserted it in its parent, the container div, and then the styles fix themselves.

TwentyTen adds padding table cells (see style.css):

#content tr td {
    border-top: 1px solid #e7e7e7;
    padding: 6px 24px;
}

The following should 'fix' this for the fullCalendar:

#content .fc tr td{
    padding:0px;
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!