javascript - jquery full calendar: set a different color to each event from front-end -


this how i'm using plugin:

jquery( document ).ready( function() {             jquery('#booking-calendar').fullcalendar({                 header: {                     left: 'prev,next',                     center: 'title',                     right: 'month,basicweek,basicday'                 },                 editable: true,                 events: '<?php echo get_template_directory_uri() ?>/bookings-feed.php'             });              jquery( '#apartment-selector' ).change( function() {                 apartment = jquery( ).val()                 jquery('#booking-calendar').fullcalendar( 'removeevents' )                 jquery('#booking-calendar').fullcalendar( 'addeventsource',  {                     url: '<?php echo get_template_directory_uri() ?>/bookings-feed.php',                     type: 'post',                     data: {                         apartment : apartment                     }                 })             })         }) 

and how looks:

enter image description here

as can see it's bit difficult track when event starts , ends, thinking of changing color of each event,

the problem here each event might splitted in different weeks (like in example) , each week has different dom event (wich makes sense) , don't have related class,

any idea how can colorize differently each event?

thanks!

to colorize each event differently there couple approaches can take tackle problem.

  1. update event feed '/bookings-feed.php' , add color(background , border), backgroundcolor, textcolor, or bordercolor event object http://arshaw.com/fullcalendar/docs/event_data/event_object/.

    events: [{     title  : 'event1',     start  : '2010-01-01',     color  : '#000' }] 
  2. separate , update event feeds use eventsources. allows group events color , text color. http://arshaw.com/fullcalendar/docs/event_data/events_array/.

    $('#calendar').fullcalendar({

    eventsources: [      // event source     {         events: [ // put array in `events` property             {                 title  : 'event1',                 start  : '2010-01-01'             },             {                 title  : 'event2',                 start  : '2010-01-05',                 end    : '2010-01-07'             },             {                 title  : 'event3',                 start  : '2010-01-09 12:30:00',             }         ],         color: 'black',     // option!         textcolor: 'yellow' // option!     }      // other event sources...  ] 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -