Skip to main content

Fade

Applies fade in/out effects by adjusting opacity during panel transitions.

import Flicking from "@egjs/flicking";
import { Fade } 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 Fade());

Summary

Key Options

OptionTypeDefaultDescription
selectorstring""CSS selector for the element to apply the effect to. If empty, the effect is applied to the panel itself
scalenumber1Effect intensity multiplier

Details

How It Works

The Fade plugin automatically adjusts opacity based on each panel's visible ratio. The currently visible panel becomes opaque, while panels moving out of view become transparent.

Usage

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

// Basic usage
flicking.addPlugins(new Fade());

// Apply to a specific element only
flicking.addPlugins(new Fade("img"));

// Adjust effect intensity
flicking.addPlugins(new Fade("", 2));

Notes

Caution
  • Using with circular: true enables a seamless fade effect.
  • If the panel background is transparent, panels behind may show through. It is recommended to use an opaque background color or image.