CSS Order
Use the useCSSOrder option to control how panel visual order is managed in circular mode. The default (false) directly changes the DOM node order, while setting it to true uses the CSS order property to keep DOM order unchanged.
After cycling through panels, check how the "DOM Order" display below differs.
- JavaScript
- React
- Vue@3
Summary
Key Options
| Option | Type | Default | Description |
|---|---|---|---|
useCSSOrder | boolean | false | Manage panel order via CSS order property |
Value Comparison
| Value | Behavior | Best For |
|---|---|---|
false | Directly rearranges DOM nodes during circular cycling (default) | Typical carousels |
true | Keeps DOM order fixed, adjusts visual order via CSS order property | Panels with iframe, video, or state that needs to be preserved |
Details
How useCSSOrder Works
A Flicking with circular: true rearranges panels to create the looping effect.
useCSSOrder: false (default): Physically moves panel DOM nodes to change their order. This is fine for simple div panels, but panels containing elements like <iframe> or <video> that reload on DOM movement will have their content reset on every cycle.
useCSSOrder: true: Keeps DOM nodes in their original position and only changes the visual order using the CSS flexbox order property. Since there is no DOM rearrangement, iframes and videos are not reloaded.
// Circular carousel with iframe panels
const flicking = new Flicking("#el", {
circular: true,
useCSSOrder: true // Manage via CSS order without DOM rearrangement
});
When using the Svelte binding, useCSSOrder: true is always applied internally. This is because Svelte's rendering approach conflicts with DOM rearrangement.
Notes
useCSSOrder: true works under the assumption that Flicking's camera element (flicking-camera) uses a flexbox layout. If you remove flexbox with custom CSS, the order may not be applied correctly.
If circular: false, panel rearrangement does not occur, so the useCSSOrder option has no effect.
Related Links
Related Options
circular: Circular mode settingcircularFallback: Fallback behavior when circular is not possible
Related Demos
- Circular: Basic circular mode usage