Skip to main content

AutoPlay

Automatically transitions panels at regular intervals. Supports pause on mouse hover.

import Flicking from "@egjs/flicking";
import { AutoPlay } from "@egjs/flicking-plugins";
import "@egjs/flicking/dist/flicking.css";
import "./styles.css";

const flicking = new Flicking("#flick", {
  circular: true,
  preventDefaultOnDrag: true
});

flicking.addPlugins(
  new AutoPlay({
    duration: 2000,
    direction: "NEXT",
    stopOnHover: true
  })
);

Summary

Key Options

OptionTypeDefaultDescription
durationnumber2000Interval between panel transitions (ms)
direction"NEXT" | "PREV""NEXT"Direction of automatic transition
stopOnHoverbooleanfalsePause autoplay on mouse hover
animationDurationnumber-Duration of the panel transition animation (ms)

Details

How It Works

The AutoPlay plugin automatically transitions panels in the specified direction at every duration interval. When the user drags, autoplay pauses and resumes after the drag ends.

Usage

import { AutoPlay } from "@egjs/flicking-plugins";

flicking.addPlugins(new AutoPlay({
duration: 2000,
direction: "NEXT",
stopOnHover: true
}));

Control Methods

MethodDescription
plugin.stop()Stop autoplay
plugin.play()Start autoplay

Notes

Caution
  • For seamless autoplay, use it together with the circular: true option.
  • When stopOnHover: true is set, it pauses on touch on mobile devices.