Skip to main content

Interruptable

The interruptable option controls whether user drag input is allowed while a panel animation is in progress.

Press the button to start a 2-second animation, then try dragging during it to see the difference.

import Flicking from "@egjs/flicking";
import "@egjs/flicking/dist/flicking.css";
import "./styles.css";

// interruptable: true (default)
const flick1 = new Flicking("#flick-interruptable", {
  duration: 2000,
  align: "center",
  interruptable: true
});

document.getElementById("btn1").addEventListener("click", () => {
  flick1.next().catch(() => {});
});

// interruptable: false
const flick2 = new Flicking("#flick-not-interruptable", {
  duration: 2000,
  align: "center",
  interruptable: false
});

document.getElementById("btn2").addEventListener("click", () => {
  flick2.next().catch(() => {});
});

Summary​

Key Options​

OptionTypeDefaultDescription
interruptablebooleantrueAllow user input during animation
changeOnHoldbooleanfalseWhether to immediately update the panel index during drag

Comparison by Value​

ValueBehaviorSuitable For
trueResponds immediately to drag during animation (default)General carousels, fast browsing
falseIgnores drag until animation completesPresentations, ensuring complete animation playback

Details​

How Interruptable Works​

When interruptable: true (default), Flicking accepts user input during animation and immediately transitions to a new drag. If a user drags while a panel is being moved by a button, the new drag starts from the current position at that moment.

When interruptable: false, it waits until the animation is fully complete before accepting the next input. Useful for slideshows or presentations where each transition effect needs to be shown completely.

// Default: drag is possible during animation
const flicking = new Flicking("#el", {
interruptable: true
});

// Allow input only after animation completes
const flicking = new Flicking("#el", {
interruptable: false,
duration: 1000
});

changeOnHold​

The changeOnHold option determines whether to immediately update the current panel index when a user pauses during a drag and "holds" a panel. With the default false, the index changes when the snap completes after release.

Use Cases​

When to use?
  • interruptable: true (default): General image galleries, product lists, and other carousels where users freely browse
  • interruptable: false: Presentation slides, onboarding screens where each slide transition animation must be shown completely
Caution

When interruptable: false with a long duration, users may feel frustrated waiting for input. Use only when necessary.

  • Duration: Setting animation duration
  • Easing: Animation acceleration curve