Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery Rails上的Fullcalendar,不同任务的不同颜色_Jquery_Ruby On Rails_Fullcalendar - Fatal编程技术网

Jquery Rails上的Fullcalendar,不同任务的不同颜色

Jquery Rails上的Fullcalendar,不同任务的不同颜色,jquery,ruby-on-rails,fullcalendar,Jquery,Ruby On Rails,Fullcalendar,我正在尝试编辑在rails应用程序上运行的Jquery Fullcalendar。我不知道如何让它识别来自同一来源的不同类型的任务,并根据它们的类型来设置它们的样式。当我实现它时,我以它为例 老实说,我甚至无法理解这种风格是如何形成的。即使只是手动设置颜色似乎也不会改变任何东西,在当前的日子里,它始终只是带有黄色背景的黑色文本。我已经尝试了许多解决类似问题的方法,我在这里看到过,但要么它们不起作用,要么我没有正确地理解它们并做了一些错误的事情 这很容易做到。您只需要在源对象中设置类名。 用了相当

我正在尝试编辑在rails应用程序上运行的Jquery Fullcalendar。我不知道如何让它识别来自同一来源的不同类型的任务,并根据它们的类型来设置它们的样式。当我实现它时,我以它为例


老实说,我甚至无法理解这种风格是如何形成的。即使只是手动设置颜色似乎也不会改变任何东西,在当前的日子里,它始终只是带有黄色背景的黑色文本。我已经尝试了许多解决类似问题的方法,我在这里看到过,但要么它们不起作用,要么我没有正确地理解它们并做了一些错误的事情

这很容易做到。您只需要在源对象中设置类名。 用了相当多的CSS选择器来覆盖默认的样式选项,看看在你的例子中什么是有效的

CSS:

Javascript:

localSource = {
  events: [ {title: 'All Day Event', start: new Date(y, m, 1)}, 
            /* More Event Data here */ ],
  className: 'localSource', // an option!
  currentTimezone: 'Europe/Bucharest', // an option!        
}; 
USHolidays = {
  url: 'http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/full',    
  className: 'gcal-event', // an option!
  currentTimezone: 'America/Chicago', // an option!
};
options = {
    eventSources: [localSource, USHolidays]
};

fullCalendar(options); // EventSources are set in options

还提到其他属性(颜色、文本颜色)。

尝试为每种不同类型的任务传递不同的CSS类。只是一个想法。
localSource = {
  events: [ {title: 'All Day Event', start: new Date(y, m, 1)}, 
            /* More Event Data here */ ],
  className: 'localSource', // an option!
  currentTimezone: 'Europe/Bucharest', // an option!        
}; 
USHolidays = {
  url: 'http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/full',    
  className: 'gcal-event', // an option!
  currentTimezone: 'America/Chicago', // an option!
};
options = {
    eventSources: [localSource, USHolidays]
};

fullCalendar(options); // EventSources are set in options