01 — Hero & thumbnails

A carousel that feels hand-made.

Looping slide engine with autoplay, keyboard support, custom arrows, numbered bullets and a parallax caption layer. The chapter strip is a second slider, synced through sync.asThumbnails.

new zikraslider()
Indigo and cyan gradient artwork
Zikra Slider Pro · v1

Slides that feel inevitable.

GPU transforms, pointer input, resize awareness and a destroy() that actually returns your DOM.

Amber gradient artwork
One engine

Vanilla. React. Next.js. Vue 3.

The same instance, refs and one destroy() per unmount — no framework lock-in.

Rose gradient artwork
Longevity

Written to be boring in ten years.

ES2020, zero runtime dependencies, three explicit animation backends and hard fallbacks.

Forest green gradient artwork
Seamless loop

No jump you can spot.

Boundary clones are inert and re-based after the transition, so the loop never resets on screen.

Violet gradient artwork
Accessible by default

ARIA roles, focus and live regions.

Keyboard navigation, labelled arrows, slide announcements and reduced-motion handling.

Ocean blue gradient artwork
Bring your own motion

GSAP, anime.js or Motion — optional.

If the library is missing or throws, the same transition falls back to WAAPI or CSS without an error.

Drag · ← → when focused · autoplay 5s
Chapters · synced thumbnails 6 topics
Chapter 101
Chapter 202
Chapter 303
Chapter 404
Chapter 505
Chapter 606
03 — Types & animation

Five layouts, five motion flavours.

Layout types and animation flavours are independent: fade, coverflow, stack, flip and cards with staggered timing. The coverflow deliberately requests GSAP, which is not loaded here — the engine degrades to WAAPI.

animation fallback

Fade

type: fade
Amber art

Crossfade

ease: fade · 900ms

Green art

Layered opacity

No stacked overflow

Blue art

Autoplay on

Pauses on hover

autoplay · bulletsfade

Coverflow

type: coverflow
Rose art

Depth

rotateY · translateZ

Violet art

Perspective

4.5D cover flow

Orchid art

Progress

Progressbar bullets

Indigo art

Ready

GSAP → WAAPI fallback

backend: pendingwaapi · gsap missing

Stack

type: stack
Ember art

Stack card 1

zoom effect

Blue art

Stack card 2

stacked depth

Amber art

Stack card 3

reduce motion ready

Green art

Stack card 4

loop + autoplay

autoplay · stacked depthzoom

Flip

effect: flip
Violet art

3D entrance

rotateY · 72°

Ember art

Direction aware

next flips left, prev right

Indigo art

Same backends

CSS · WAAPI · libraries

perspective panel · autoplayflip

Cards + stagger

type: cards · stagger
Amber art

Wave timing

delay grows with distance

Green art

Cards layout

rotateZ · layered scale

Orchid art

Loop safe

cyclic relative math

Rose art

Drag ready

threshold + velocity

stacked rotation · autoplaystagger
04 — Animation engines

One option, four engines.

Point animation.library at anime.js or Motion One and every transition is handed to that library. Switch to WAAPI or CSS to watch the fallback ladder — the slides and options stay the same; only the engine changes. Libraries load from jsDelivr on demand.

live backend
Indigo art

anime.js

v4 namespace · v3 function

Rose art

Motion One

UMD Motion global

Violet art

WAAPI

Element.animate fallback

Orchid art

CSS

Transitions, no library

Scripts load from jsDelivr only when you pick them.
backend: — script: none needed
05 — Slides at runtime

Add and remove slides after init.

appendSlide(), prependSlide() and removeSlide() accept an HTML string, an element or a NodeList — removal also takes an index. Counts, slide labels, bullets and the active slide stay in sync, and a prepend keeps the current slide in view.

appendSlide · prependSlide
Indigo art

Original 01

in the markup

Amber art

Original 02

in the markup

Rose art

Original 03

in the markup

HTML string · element · index
06 — Accessibility

Accessible before you ask.

On by default: a labelled region, slide groups announced as “n of m”, a polite live region, inert + aria-hidden off-screen slides, arrow-key control while focused, and a reduced-motion path. Enable nothing; the inspector updates as you move.

a11y: on
Green art

Region

role + aria-roledescription

Violet art

Groups

“2 of 4”, one per slide

Blue art

Live region

“Slide 3 of 4” (polite)

Orchid art

Inert

off-screen slides leave the tab order

Tab reaches the slider · ← → Home End
07 — Lifecycle

new, then destroy — markup comes back.

The factory and the constructor return the same instance. destroy() stops timers, removes generated controls and ARIA, and restores your class, id, inline style and slide attributes, so re-initialising — or leaving the page — is clean.

new zikraslider()
Ember art

One instance

constructed with new

Indigo art

destroy()

markup restored

Rose art

Re-init

no stale listeners

16.6 kB gzip · 0 dependencies
instance: live zikraslider.get() → instance
08 — Runtime API

Drive it. Break it. Rebuild it.

Free-mode dragging, wheel input, responsive breakpoints, live update(), cancellable beforeChange, and a genuine destroy() / re-init cycle.

live state
Indigo art

Free mode

Momentum + snap

Amber art

Wheel

Throttled, passive option

Rose art

Keyboard

Focus, arrows, Home / End

Green art

Responsive

Breakpoint-driven options

Violet art

Events

beforeChange · afterChange

09 — Integration

Two calls, one lifecycle.

Install with npm install zikra-slider-pro, then call it as a factory or with new. Both return the same instance, with update(), on() and destroy() ready.

VanillaReactNext.js App RouterVue 3

Vanilla JS

Script tag global or ES module import.

const slider = zikraslider('#hero', {
  type: 'slide',
  loop: true,
  slidesPerView: 1,
  features: { autoplay: { enabled: true } },
  animation: { library: 'auto', effect: 'zoom' },
  on: {
    beforeChange(e) { // return false to cancel }
  }
});

slider.on('afterChange', ({ index }) => console.log(index));
slider.goTo(2);
slider.destroy(); // restores the original DOM

Framework wrappers

See examples/react, examples/nextjs and examples/vue for ready-to-copy components.

// React / Next.js ('use client')
useEffect(() => {
  let slider;
  import('zikra-slider-pro').then(({ default: zs }) => {
    slider = zs(ref.current, options);
  });
  return () => slider?.destroy();
}, []);

// Vue 3
onMounted(() => { instance = zikraslider(el.value, props.options); });
onBeforeUnmount(() => instance?.destroy());
10 — Guides

Go deeper than the demo.

Long-form guides for the decisions around the engine: picking an alternative, getting accessibility right, and keeping the bundle small.

Frequently asked questions

Does Zikra Slider Pro require GSAP, anime.js or Motion?

No. GSAP, anime.js and Motion are optional. With animation.library set to 'auto', the engine uses whichever library is already loaded, then falls back to the Web Animations API and finally to CSS transitions.

Is Zikra Slider Pro a drop-in replacement for Swiper?

No. The APIs are different, so a Swiper configuration has to be mapped option by option and re-tested. Simple sliders move quickly, but it is not a find-and-replace.

Can I add or remove slides after init?

Yes. appendSlide(), prependSlide() and removeSlide() accept HTML strings, elements or arrays, and the engine renumbers data-zs-index, ids and the 'n of m' slide labels automatically.

Does destroy() really restore my markup?

Yes. destroy() removes generated nodes and restores the original classes, ids, ARIA attributes, inline styles and the engine's data-zs-media markers, so the host matches its pre-init markup.

Does it work with React and Next.js?

Yes. A React component ships as zikra-slider-pro/react, and the examples folder includes a Next.js App Router client component that destroys the instance on unmount.