Swiper Coverflow 3D Product Carousel — Free JS Snippet

Swiper Coverflow 3D Product Carousel · Carousels · Plain HTML, CSS & JS · Live preview

What's included

Features

Built-in coverflow effect with tunable rotate, depth, stretch and modifier
Centred active slide with auto-width slides so neighbours peek in
Slide shadows that reinforce the 3D depth
slideToClickedSlide so tapping a neighbour focuses it
Keyboard and forced-axis mouse-wheel control
Dynamic pagination bullets for longer lists
slideChange event driving a live product details panel
Single data array renders both slides and details

About this UI Snippet

Swiper Coverflow 3D Product Carousel — HTML, CSS & JavaScript

Screenshot of the Swiper Coverflow 3D Product Carousel snippet rendered live

Coverflow is the carousel style made famous by the iTunes album browser: one item faces you at the centre while its neighbours turn away and recede into the background. It suits product showcases because it keeps one item in focus while hinting that there are more to explore. Swiper ships it as a built-in effect, so a convincing 3D carousel needs a few options rather than custom transforms.

The effect: 'coverflow' option alone is not enough; three companion settings make it work. centeredSlides: true keeps the active slide in the middle, slidesPerView: 'auto' lets each slide's width come from your CSS instead of dividing the container evenly — this is what lets the neighbours peek in from either side — and coverflowEffect tunes the geometry. rotate sets how many degrees the side slides turn away, depth pushes them back on the z-axis, stretch adds spacing, and modifier scales all of them together. Enabling slideShadows adds the soft shading on receding slides that sells the depth. A common mistake is forgetting that the container needs overflow: visible for the outer slides to appear beyond it, which is set on the swiper element here.

Interaction is where a carousel earns its keep. grabCursor signals that it can be dragged, keyboard control makes the arrow keys work, and a mousewheel setting with forceToAxis stops a diagonal trackpad swipe from scrolling the page and the carousel at once. slideToClickedSlide is a small but important usability touch: clicking a partly visible neighbour brings it to the front, which is what people instinctively try.

The panel under the carousel demonstrates the standard pattern for connecting a slider to the rest of the page. The slideChange event fires whenever the active slide changes — by dragging, keys, clicks or pagination — and the handler reads swiper.activeIndex to update the product name, description and price. Data lives in one array that renders both the slides and the details, so they cannot drift apart. The pagination uses dynamicBullets so seven products stay tidy, and each slide is drawn with a CSS gradient and an emoji, so the demo needs no image files.

Step by step

How to Use

  1. 1
    Drag the carouselDrag left or right. The centre product turns to face you while the others rotate away.
  2. 2
    Click a neighbourClick a partly visible product to bring it to the front.
  3. 3
    Use the keyboard or wheelUse the arrow keys or scroll the mouse wheel over the carousel to move between products.
  4. 4
    Watch the detailsThe panel below updates with the active product's name, description and price.
  5. 5
    Add to cartPress Add to cart for a quick confirmation state on the button.

Real-world uses

Common Use Cases

🛍️
Product showcases
Highlight featured items on a landing page with one product facing the viewer and neighbours turned away and receding, using the built-in coverflow effect.
🎨
Portfolio pickers
Let visitors flip through portfolio work, with slideToClickedSlide so tapping a neighbouring item focuses it immediately.
🎵
Music and media browsing
Recreate the album-cover browsing style for music and media, with auto-width slides letting neighbours peek in at the sides.
🖼️
Thumbnail synced galleries
Compare with the Swiper thumbnail synced gallery when a plain image strip suits the product better than 3D.
🎓
3D transforms in sliders
Experiment with rotate, depth, stretch and modifier values, with slide shadows reinforcing the sense of depth.

Got questions?

Frequently Asked Questions

Ensure centeredSlides is true, slidesPerView is "auto" with a fixed slide width in CSS, and the container allows overflow so neighbours are visible.

rotate turns side slides away in degrees, depth pushes them back in 3D space, and stretch adds spacing between slides.

Listen for the slideChange event and read swiper.activeIndex.

Use mousewheel with forceToAxis: true and a thresholdDelta so intentional wheel movement drives the carousel.

Set slideToClickedSlide: true.

Loop mode works but needs enough slides to duplicate; with few slides it can look wrong, so test with your data.

Yes. Use the JSX, Vue, Angular or Tailwind export buttons on this page to convert the markup and styles. The behaviour comes from Swiper, so in a framework project install it with npm install swiper (its React and Vue components take the same options) instead of the CDN tag, use the Swiper and SwiperSlide components, or create it in useEffect / onMounted / ngAfterViewInit, and release it with destroy() when the component unmounts.

Build with AI

Build, Understand, Optimize, and Extend It With AI

Ask an AI assistant like Claude to add reflections under each slide, autoplay that pauses on hover, or a fullscreen preview when the centre slide is clicked.

Prompt to recreate it

Copy this into your AI assistant of choice to build the effect from scratch, or as a jumping-off point for your own variant:

text
Build a 3D coverflow product carousel with Swiper 11 loaded from a CDN (bundle script and CSS).

Requirements:
- Render seven product slides from an array using CSS gradients and emoji; use effect 'coverflow', centeredSlides, slidesPerView 'auto', grabCursor and slide widths set in CSS.
- Configure coverflowEffect with rotate 38, depth 140, stretch 0, modifier 1 and slideShadows, plus keyboard, mousewheel (forceToAxis), slideToClickedSlide and dynamic clickable pagination.
- Update a details panel (name, description, price) on the slideChange event using swiper.activeIndex.
- Add an Add to cart button with a temporary confirmation state.

Want to tighten it up first? Run this prompt through the AI Prompt Studio to score it across 8 quality dimensions, catch anti-patterns, and tune the wording for Claude, ChatGPT, or Gemini before you paste it in.

Source Code

<div class="cf-wrap">
  <div class="swiper cf-swiper" id="cfSwiper">
    <div class="swiper-wrapper" id="cfSlides"></div>
    <div class="swiper-pagination"></div>
  </div>
  <div class="cf-info" aria-live="polite">
    <div><b id="cfName">-</b><span id="cfNote">-</span></div>
    <div class="cf-buy"><strong id="cfPrice">-</strong><button type="button" id="cfBtn">Add to cart</button></div>
  </div>
</div>