---
title: "jQuery Timeline Event Buffer Time Example | Mobiscroll"
component: "Timeline"
framework: "jQuery"
library_version: "6.2.0"
url: "https://demo.mobiscroll.com/jquery/timeline/event-buffer"
---

# Event Buffer Time - jQuery Timeline demo

Visualize buffer time on a jQuery Timeline — show travel time, check-in/out, loading/unloading time, or preparation windows around scheduled events.

- [Live demo](https://demo.mobiscroll.com/jquery/timeline/event-buffer)
- [View code on GitHub](https://github.com/acidb/mobiscroll-demos-jquery/tree/main/src/demos/eventcalendar/timeline/event-buffer)
- This demo in other frameworks: [JavaScript](https://demo.mobiscroll.com/timeline/event-buffer.md), [Angular](https://demo.mobiscroll.com/angular/timeline/event-buffer.md), [React](https://demo.mobiscroll.com/react/timeline/event-buffer.md), [Vue](https://demo.mobiscroll.com/vue/timeline/event-buffer.md)

## Description

Use the `bufferBefore` and `bufferAfter` to add buffer times that will be rendered before and after the event.

These areas can help you visualize delays or added minutes for tasks. Here are some examples:

- Travel time for meetings, appointments, work orders
- Check in and check out times around flights
- Loading/unloading for bus/truck
- Cleaning, inspection, maintenance work that happen on a recurring basis

**Looking to customize event buffers?** [Check out the templating capabilities →](https://demo.mobiscroll.com/jquery/timeline/timeline-custom-event-rendering)

## What this demo shows

- A desktop timeline showing a single day with hours arranged horizontally and resources arranged vertically.
- **Header navigation** The month and year label opens date navigation, while the previous and next arrows and the Today button move between dates and return to the current day.
- **Day view** A fixed date strip below the header shows the selected date in `DD DDD MMM YYYY` format, with the current date highlighted.
- **Time grid** The timeline displays hourly columns from 12 AM to 12 PM.
- **Resources** Multiple resources appear as separate rows on the left side of the timeline.
- **Current time** A vertical blue line with a time label marks the current time.
- **Hover behavior** Hovering over the time grid shows a time indicator that follows the cursor in 15-minute increments.
- **Event cards** Events appear as colored cards with a left color stripe, the time range below the title, and the title shown in bold.
- **Event buffers** When event buffer display is enabled, buffer time renders before and/or after the event block to show added time around the scheduled event.
- **Buffer control** A control above the timeline lets users turn event buffer display on or off. Buffer display is enabled by default.
- **Event overlapping** Overlapping events are placed side by side so each event remains visible.
- **Event positioning** Events are positioned by assigned resource, date, start time, and end time.
- **Event interaction** Events highlight on hover and expose drag and resize handles for moving events or changing their duration.
- **Event selection** Clicking an event selects and highlights it.
- **Event creation** Users can create events by double-clicking the timeline or by clicking and dragging across a time range.
- **Scrolling** The timeline supports horizontal and vertical scrolling for navigating through time and resources.

## Best for

- **Travel time** Showing travel time before or after meetings, appointments, and work orders.
- **Check-in and check-out windows** Visualizing time around flights, bookings, or scheduled appointments.
- **Loading and unloading time** Planning additional time around bus, truck, delivery, or transport work.
- **Preparation and cleanup work** Displaying cleaning, inspection, maintenance, or other recurring work that happens before or after the main scheduled event.
- **Delay visibility** Making added minutes or expected delays visible directly in the timeline.

## Tutorial

### Control the event buffer display globally

- [x] Turn event buffer display ON/OFF

```js
$('#calendar').mobiscroll().eventcalendar({
    view: {timeline: { type: 'day' }},
    showEventBuffer: true,
    // event example
    data: [{
        bufferBefore: 30,
        bufferAfter: 120,
        start: '2026-11-04T16:00',
        end: '2026-11-04T20:00',
        title: 'Friends binge marathon',
        resource: 4,
    },{
        bufferAfter: 30,
        start: '2026-11-04T06:00',
        end: '2026-11-04T08:00',
        title: 'Morning routine',
        resource: 1,
    }, {
        bufferBefore: 45,
        start: '2026-11-04T09:30',
        end: '2026-11-04T12:00',
        title: 'Product team mtg.',
        resource: 4,
    }],
});
```

## API used in this demo

- [`theme`](https://mobiscroll.com/docs/jquery/eventcalendar/api#opt-theme) - option
- [`themeVariant`](https://mobiscroll.com/docs/jquery/eventcalendar/api#opt-themeVariant) - option
- [`view`](https://mobiscroll.com/docs/jquery/eventcalendar/api#opt-view) - option
- [`showEventBuffer`](https://mobiscroll.com/docs/jquery/eventcalendar/api#opt-showEventBuffer) - option
- [`resources`](https://mobiscroll.com/docs/jquery/eventcalendar/api#opt-resources) - option
- [`data`](https://mobiscroll.com/docs/jquery/eventcalendar/api#opt-data) - option

## Code

### JS

```js
mobiscroll.setOptions({
  theme: 'ios',
  themeVariant: 'light'
});

$(function () {
  $('#demo-event-buffer')
    .mobiscroll()
    .eventcalendar({
      view: {
        timeline: { type: 'day' },
      },
      showEventBuffer: true,
      resources: [
        {
          id: 1,
          name: 'Resource 1',
          color: '#e20000',
        },
        {
          id: 2,
          name: 'Resource 2',
          color: '#76e083',
        },
        {
          id: 3,
          name: 'Resource 3',
          color: '#4981d6',
        },
        {
          id: 4,
          name: 'Resource 4',
          color: '#f7961e',
        },
      ],
      data: [
        {
          bufferAfter: 30,
          start: '2026-11-04T06:00',
          end: '2026-11-04T08:00',
          title: 'Morning routine',
          resource: 1,
        },
        {
          bufferAfter: 120,
          bufferBefore: 30,
          start: '2026-11-04T16:00',
          end: '2026-11-04T20:00',
          title: 'Friends binge marathon',
          resource: 4,
        },
        {
          bufferAfter: 120,
          bufferBefore: 30,
          start: '2026-11-04T13:00',
          end: '2026-11-04T21:00',
          title: 'Mastering CSS class',
          resource: 2,
        },
        {
          bufferAfter: 10,
          bufferBefore: 15,
          start: '2026-11-04T08:00',
          end: '2026-11-04T10:00',
          title: 'Product team mtg.',
          resource: 2,
        },
        {
          bufferAfter: 20,
          bufferBefore: 30,
          start: '2026-11-04T16:30',
          end: '2026-11-04T19:30',
          title: 'Cinema afternoon',
          resource: 3,
        },
        {
          bufferAfter: 10,
          bufferBefore: 10,
          start: '2026-11-04T08:30',
          end: '2026-11-04T10:00',
          title: 'Quick mtg. with Martin',
          resource: 3,
        },
        {
          bufferBefore: 45,
          start: '2026-11-04T09:30',
          end: '2026-11-04T12:00',
          title: 'Product team mtg.',
          resource: 4,
        },
      ],
    });
});
```

### HTML

```html
<div id="demo-event-buffer"></div>
```

## Implementation notes

- Set `timeline: { type: 'day' }` for a single-day timeline view showing all resources as rows.
- Enable buffer rendering by setting `showEventBuffer: true` on the `Eventcalendar` component. Without this prop the buffer zones are not displayed even if events carry buffer data.
- Add `bufferBefore` and/or `bufferAfter` to individual event objects. Both values are in minutes and are independent - an event can have only before, only after, or both. The buffer zone is rendered as a distinct shaded area adjacent to the event block.
- Define 4 resources with `id`, `name`, and `color`. Use today's date with time offsets (via a relative date helper) for event `start` and `end` so events always appear on the current day.
- Include a variety of buffer combinations to illustrate all cases: `bufferAfter` only (e.g. 30 min after morning routine), `bufferBefore` + `bufferAfter` (e.g. 30 min before and 120 min after a long session), and small symmetric buffers (e.g. 10 min on both sides of a short meeting).

## Run it in your project

1. If not signed up yet, or don't own a license, you can [start a free trial](https://mobiscroll.com/starttrial).

2. Clone the repository:

   ```
   git clone https://github.com/acidb/mobiscroll-demos-jquery.git
   ```

3. If not installed yet, install the Mobiscroll CLI from NPM:

   ```
   npm install -g @mobiscroll/cli
   ```

4. Config Mobiscroll - open a terminal window in the root directory and run:

   ```
   mobiscroll config jquery
   ```

5. Install dependencies - open a terminal window in the root directory and run:

   ```
   npm install
   ```

6. Run the project:

   ```
   npm run dev
   ```

On a trial, add `--trial` to the config command: `mobiscroll config jquery --trial`.

Running a demo locally requires a Mobiscroll trial or a license; setup is per framework at https://mobiscroll.com/docs/jquery/getting-started/installation

## Related demos

- Previous: [Limit Concurrent Events](https://demo.mobiscroll.com/jquery/timeline/control-number-of-concurrently-shown-events.md) - Set a maximum number of concurrent events on a jQuery Timeline — cap overlapping events per row and show an overflow indicator for hidden events.
- Next: [Custom Range Picker View](https://demo.mobiscroll.com/jquery/timeline/custom-range-view.md) - Replace the jQuery Timeline's default header navigation with a range picker — let users set any custom date range, synced two-way with the timeline.
