Skip to main content

Default

The most basic usage of Flicking. You can check the required HTML structure, CSS, and default option values.

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

const _flicking = new Flicking("#flick", {
  align: "center"
});

Summary​

Default Option Values​

When created without any options, the following defaults are applied:

OptionDefaultDescription
align"center"Panel alignment position
horizontaltrueHorizontal movement
circularfalseCircular mode disabled
boundfalseNo boundary restriction
duration500Animation 500ms
moveType"snap"Snap movement type

Required Elements​

ElementRequiredDescription
.flicking-viewportRequiredThe viewport element to which the Flicking instance is attached
.flicking-cameraRequiredThe container that holds the panels. The element that actually moves
Panel elementsRequiredDirect children of .flicking-camera
flicking.cssRequiredBase stylesheet

Details​

HTML Structure​

Flicking requires the following structure:

<div class="flicking-viewport">
<div class="flicking-camera">
<div class="panel">Panel 1</div>
<div class="panel">Panel 2</div>
<div class="panel">Panel 3</div>
</div>
</div>
  • flicking-viewport: Defines the visible area. overflow: hidden is applied.
  • flicking-camera: Wraps the panels and moves during drag/animation.
  • Panels: Each slide's content. Must be direct children of the camera.

CSS Import​

You must import the Flicking CSS:

// JavaScript
import "@egjs/flicking/dist/flicking.css";

// React
import "@egjs/react-flicking/dist/flicking.css";

// Vue
import "@egjs/vue3-flicking/dist/flicking.css";

Notes​

Required

If you do not import flicking.css, panels will not be positioned correctly. It contains the default styles for the viewport and camera.

Structure caution

Panel elements must be direct children of .flicking-camera. It will not work if there are other wrapper elements in between.