Skip to main content

Threshold

The threshold option sets the minimum drag distance in pixels required for panel transition. Dragging less than this value will return to the original panel.

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

// threshold: 10 (sensitive)
new Flicking("#flick-low", {
  threshold: 10,
  align: "center"
});

// threshold: 40 (default)
new Flicking("#flick-default", {
  threshold: 40,
  align: "center"
});

// threshold: 100 (insensitive)
new Flicking("#flick-high", {
  threshold: 100,
  align: "center"
});

Summary

Key Options

OptionTypeDefaultDescription
thresholdnumber40Minimum drag distance for panel transition (px)

Comparison by Value

ValueBehaviorSuitable For
10Easy transition with short dragFast browsing, when sensitive response is needed
40Moderate drag required (default)General carousels
100Long drag required, short drags return to originalPreventing accidental transitions, when careful transitions are needed

Details

How Threshold Works

When a user releases after dragging, if the movement distance is greater than the threshold, the panel transitions to the next/previous panel; if less, it returns to the original panel.

// Low value: sensitive transition
threshold: 10 // Transitions when dragged 10px or more

// Default
threshold: 40 // Transitions when dragged 40px or more

// High value: careful transition
threshold: 100 // Transitions when dragged 100px or more
  • Relationship with moveType: "strict": In "strict" mode, threshold is particularly important in determining whether to transition one panel.
  • Difference from dragThreshold: dragThreshold is the minimum distance for drag recognition, while threshold is the minimum distance for panel transition.

Use Cases

When to use?
  • Low value (10-20px): Fast content browsing, when you want to increase swipe sensitivity
  • Default (40px): General carousels, image galleries
  • High value (80-100px): Preventing accidental transitions, when showing important content

Notes

Too low threshold

If the threshold is too low, unintended panel transitions may occur. On touch devices in particular, scrolling and swiping may be confused.

Too high threshold

If the threshold is too high, users may feel that swiping is not working. Generally, around 10-20% of the panel width is appropriate.

  • moveType: Movement behavior mode (important when used with strict)
  • dragThreshold: Minimum distance for drag recognition