DayPilot.Scheduler.scrollTo

The scrollTo() method sets the horizontal scrollbar position of the JavaScript Scheduler to the target date.

The move to the target position can be animated (use the animated parameter).

You can also specify the position of the target date/time using the position parameter.

When infinite scrolling is enabled, the Scheduler will shift the timeline automatically if the target date isn't in the current timeline.

Declaration

DayPilot.Scheduler.scrollTo(date | pixels[, animated[, position]]);

Parameters

  • date (string in ISO 8601 format, DayPilot.Date object) - target date/time

  • pixels (number) - target position in pixels

  • animated ("fast" | "normal" | "slow" | "linear") - scrolling animation; null means no scrolling, "linear" adjusts the speed depending on distance 

  • position ("left", "middle", "right") - target position of  date within the viewport (default is "left")

Examples

Scroll to current time.

dp.scrollTo(DayPilot.Date.now());

Scroll to January 1, 2025:

dp.scrollTo("2025-01-01");

Demo