The events listed in the popover can be customized in two ways:

  • Full event customization (like in this example) - The calendar handles the rendering of events in the correct order. Styling the content, colors and everything else is your responsibility.
  • Content customization - The calendar prints the start and end times, allDay and sets the appropriate color. Content like title and other fields can be shown.

You can provide styling to the title field and any other custom fields like description, location, participants ...

Pass a rendering function to the renderPopoverEventContent option. All original event fields along with computed fields like isMultiDay, lastDay are passed to the function. For a fully custom event rendering use the renderPopoverEvent option.

If you add custom markup you will want to add styling too. Use the popoverClass under the view option to tell the calendar what CSS class it should append to the popover container so that you can write specific CSS rules.

Download and try example

Demo

Loading the live demo

Preview in full screen

Customize how events appear in the day popover of a event calendar — use full custom layouts or add fields like assignee, location, and participants.

Code

var inst = mobiscroll.eventcalendar('#demo-custom-event-popover', {
  locale:  ,
  theme: ' ',
  themeVariant: ' ',
  clickToCreate:  ,
  dragToCreate:  ,
  dragToMove:  ,
  dragToResize:  ,
  eventDelete:  ,
  view: {
    calendar: {
      labels: false,
      popover: true,
      popoverClass: 'custom-event-popover',
    },
  },
  renderPopoverEventContent: function (data) {
    return (
      '<div">' +
      data.title +
      '</div>' +
      '<div class="md-custom-event-cont">' +
      '<img class="md-custom-event-img" src="' +
      getParticipant(data.original.participant).img +
      '"/>' +
      '<div class="mbsc-custom-event-name">' +
      getParticipant(data.original.participant).name +
      '</div>' +
      '<button mbsc-button class="md-custom-event-btn" data-color="primary" data-variant="outline">Add participant</button>' +
      '</div>'
    );
  },
  onEventClick: function (args) {
    if (args.domEvent.target.classList.contains('md-custom-event-btn')) {
      args.domEvent.stopPropagation();
      mobiscroll.toast({
        message: getParticipant(args.event.participant).name + "'s event clicked",
      });
    }
  },
});

function getParticipant(id) {
  switch (id) {
    case 1:
      return {
        img: 'https://img.mobiscroll.com/demos/m1.png',
        name: 'Barry L.',
      };
    case 2:
      return {
        img: 'https://img.mobiscroll.com/demos/f1.png',
        name: 'Hortense T.',
      };
    case 3:
      return {
        img: 'https://img.mobiscroll.com/demos/m2.png',
        name: 'Carl H.',
      };
  }
}

mobiscroll.getJson(
  'https://trial.mobiscroll.com/custom-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.