Skip to main content

Quick Start

Get started with Flicking in 5 minutes. This guide covers installation and creating your first carousel for JavaScript, React, and Vue3.

Installation

Install Flicking using npm or yarn:

npm install @egjs/flicking
# or
yarn add @egjs/flicking

Using CDN (JavaScript Only)

For quick prototyping or simple projects, you can use CDN links:

<!-- JavaScript -->
<script src="https://unpkg.com/@egjs/flicking/dist/flicking.pkgd.min.js"></script>

<!-- CSS -->
<link rel="stylesheet" href="https://unpkg.com/@egjs/flicking/dist/flicking.css" />
info

CDN usage is convenient for testing, but using package managers is recommended for production.


Basic Setup

HTML Structure:

<div id="carousel" 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>

JavaScript:

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

// Initialize Flicking
const flicking = new Flicking("#carousel", {
align: "center",
circular: true
});
Required
  • Base CSS: Must import @egjs/flicking/dist/flicking.css
  • HTML Structure: .flicking-viewport and .flicking-camera wrapper divs are required
  • Fixed Class Names: .flicking-viewport and .flicking-camera cannot be changed
  • Flexible Panel Class: Panel class name is your choice (.panel, .slide, .item, etc.)
  • Panel Detection: Direct children of .flicking-camera become panels
Want to style your carousel?

Flicking provides minimal base styles to give you maximum styling freedom. The required base CSS handles only functionality, not design. Learn about HTML Structure & Styling to understand Flicking's architecture and how to style your carousel. This guide covers:

  • How Flicking's 3-layer structure works
  • Why the base CSS is required
  • Common styling patterns and best practices

Using Methods

You can control Flicking programmatically using methods:

const flicking = new Flicking("#carousel");

// Move to specific panel
flicking.moveTo(2);

// Move to next panel
flicking.next();

// Move to previous panel
flicking.prev();

See Flicking Methods for all available methods.


Listening to Events

Handle user interactions by listening to events:

const flicking = new Flicking("#carousel");

// Listen to changed event (fired AFTER panel change)
flicking.on("changed", (e) => {
console.log("Current panel index:", e.index);
});

// Listen to willChange event (fired BEFORE panel change)
flicking.on("willChange", (e) => {
console.log("Moving to panel:", e.index);
});

See Event Interfaces for all available events.


Next Steps

Now that you have a basic carousel working, explore more features:


Troubleshooting

Panels not displaying correctly?

Make sure you've imported the CSS file:

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

Need more help? Check GitHub Issues or read the API documentation