Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change selection color in FullCalendar

this is more of a two pronged question. Based on items I've tried, there is no way to change the "selectable/selectableOverlap" of a full calendar after it is initialized. The reason I'd like to do that is to have a toggle on the page that allows the user to indicate whether or not they'd like to be able to select or not on the calendar control.

In lieu of that, since the "select" callback is only called when the selection is released (and I want to prevent selection visually), my thought was to just set the opacity of the selected cells to 0 so that they are not shown and I can just unselect when the select callback executes. However, I cannot find a way to modify the colors or css properties of the cells being selected, as shown here:

enter image description here

Is there a way to change the css properties of the cells being selected, or perhaps the first way of dynamically changing whether selection works?

Thanks -

like image 835
James F Avatar asked May 13 '15 15:05

James F


People also ask

How do I change colors in fullCalendar?

You can change the color of all events on the calendar like so: var calendar = new Calendar(calendarEl, { events: [ // my event data ], eventColor: '#378006' }); You can use any of the CSS color formats such #f00 , #ff0000 , rgb(255,0,0) , or red .

How do I change my fullCalendar theme?

It is possible to change the look of the calendar (colors, fonts, etc) by applying a theme. Renders the calendar with a given theme system. In order to correctly theme your calendar with a Bootstrap 5 theme, you must include the correct stylesheets, include the JavaScript plugin, and set themeSystem to 'bootstrap5'.

How do I select multiple dates in fullCalendar?

Detect when the user clicks on dates or times. Give the user the ability to select multiple dates or time slots with their mouse or touch device. Allows a user to highlight multiple days or timeslots by clicking and dragging.

How do I change my name in fullCalendar?

If you want to change the contents of the title itself, you need to change the titleFormat. firstDay: <? php echo $iFirstDay; ?>, header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, titleFormat: '\'Hello, World!\


1 Answers

The color of selected cells are defined in .fc-highlight. To change the selection color, I would simply do it by

$("#calendar").fullCalendar({
  select: function(start, end){
    // other code here
    // ..
    $(".fc-highlight").css("background", "red");
  }
});
like image 131
worrawut Avatar answered Sep 18 '22 23:09

worrawut