Custom Time Range Backgrounds

Besides customizing the background color of cells and setting up invalid/blocked out times you can customize how these blocks and disabled times look by passing a cssClass to the colors and invalid array elements.

The output could be a custom pattern, custom styling for the labels or anything that you'd like to render as the background. This a great way for adding special meaning to certain days and time ranges.

Download and try example

Demo

Loading the live demo

Preview in full screen

Style a Timeline with disabled periods — add background patterns or labels to mark recurring hours, special days, or blocked slots.

Code

mobiscroll.setOptions({
  locale:  ,
  theme: ' ',
  themeVariant: ' '
});

var inst = mobiscroll.eventcalendar('#demo-colors-invalids-css-class', {
  clickToCreate:  ,
  dragToCreate:  ,
  dragToMove:  ,
  dragToResize:  ,
  eventDelete:  ,
  view: {
    timeline: {
      allDay: false,
      type: 'week',
      startDay: 1,
      endDay: 5,
      startTime: '09:00',
      endTime: '18:00',
    },
  },
  invalid: [
    {
      start: '12:00',
      end: '13:00',
      title: 'Lunch break',
      recurring: {
        repeat: 'weekly',
        weekDays: 'MO,TU,WE,TH,FR',
      },
      cssClass: 'md-lunch-break-class mbsc-flex',
    },
  ],
  colors: [
    {
      resource: 2,
      start: '09:00',
      end: '11:00',
      recurring: {
        repeat: 'weekly',
        weekDays: 'MO',
      },
      cssClass: 'md-rect-bg',
    },
    {
      resource: 1,
      start: '10:00',
      end: '12:00',
      recurring: {
        repeat: 'weekly',
        weekDays: 'WE',
      },
      cssClass: 'md-rect-bg',
    },
    {
      resource: 3,
      start: '14:00',
      end: '17:00',
      recurring: {
        repeat: 'weekly',
        weekDays: 'TH',
      },
      cssClass: 'md-rect-bg',
    },
    {
      resource: 4,
      start: '13:00',
      end: '18:00',
      recurring: {
        repeat: 'weekly',
        weekDays: 'MO',
      },
      cssClass: 'md-rect-bg',
    },
    {
      resource: 1,
      start: '09:00',
      end: '12:00',
      recurring: {
        repeat: 'weekly',
        weekDays: 'FR',
      },
      cssClass: 'md-stripes-bg',
    },
    {
      resource: 3,
      start: '09:00',
      end: '12:00',
      recurring: {
        repeat: 'weekly',
        weekDays: 'TU',
      },
      cssClass: 'md-stripes-bg',
    },
    {
      resource: 5,
      start: '10:00',
      end: '12:00',
      recurring: {
        repeat: 'weekly',
        weekDays: 'MO',
      },
      cssClass: 'md-stripes-bg',
    },
    {
      resource: 5,
      start: '13:00',
      end: '17:00',
      recurring: {
        repeat: 'weekly',
        weekDays: 'TU',
      },
      cssClass: 'md-stripes-bg',
    },
    {
      resource: 1,
      start: '09:00',
      end: '12:00',
      recurring: {
        repeat: 'weekly',
        weekDays: 'TH',
      },
      cssClass: 'md-dots-bg',
    },
    {
      resource: 2,
      start: '06:00',
      end: '12:00',
      recurring: {
        repeat: 'weekly',
        weekDays: 'TU',
      },
      cssClass: 'md-dots-bg',
    },
    {
      resource: 4,
      start: '15:00',
      end: '17:00',
      recurring: {
        repeat: 'weekly',
        weekDays: 'FR',
      },
      cssClass: 'md-dots-bg',
    },
    {
      resource: 4,
      start: '14:00',
      end: '18:00',
      recurring: {
        repeat: 'weekly',
        weekDays: 'WE',
      },
      cssClass: 'md-dots-bg',
    },
  ],
  resources: [
    {
      id: 1,
      color: '#ff0101',
      name: 'Resource A',
    },
    {
      id: 2,
      color: '#239a21',
      name: 'Resource B',
    },
    {
      id: 3,
      color: '#8f1ed6',
      name: 'Resource C',
    },
    {
      id: 4,
      color: '#01adff',
      name: 'Resource D',
    },
    {
      id: 5,
      color: '#d8ca1a',
      name: 'Resource E',
    },
  ],
});

mobiscroll.getJson(
  'https://trial.mobiscroll.com/timeline-events/',
  function (events) {
    inst.setEvents(events);
  },
  'jsonp',
);
  

Duplicate Session

You have signed in on a different machine. To keep everything in sync, you have been signed out of this session.

If you need to invite team members, manage seats and accounts you can do it from the licenses page.

Duplicate Session

We noticed you are logged in on a different machine and have closed your old session.

If you need to invite team members, manage seats and accounts you can do it from the licenses page.