Drag, swipe, hover-preview — a tiny, zero-dependency slider built for e-commerce product cards. Works with vanilla JS, React, Vue, and Shopify.
Gzipped size
Dependencies
Config options
Licensed
Features
Built to be tiny, fast, and accessible out of the box — no heavy frameworks or CSS required.
Native-feeling drag and swipe with momentum physics. Touch and mouse supported with configurable thresholds.
Shopify-style horizontal zone preview. Move the cursor across the image to browse all angles instantly.
Configurable autoplay on hover with adjustable interval. Optional infinite loop wraps seamlessly.
IntersectionObserver-powered lazy loading. Off-screen images stay unloaded until the card enters the viewport.
ARIA roles, keyboard navigation, and focus management built in. Screen reader friendly out of the box.
Vanilla JS core. Works with React, Vue, Svelte, or plain HTML. ESM and UMD bundles included.
Live Demo
Interactive product cards powered by ProductCardSlider. Try dragging, hovering, and clicking arrows.
Quick Start
Just add your images, import the library, and initialize. That's it.
<!-- Your product card markup --> <div class="product-slider"> <img src="shoe-1.jpg" alt="Front"> <img src="shoe-2.jpg" alt="Side"> <img src="shoe-3.jpg" alt="Back"> </div>
import ProductCardSlider from 'product-card-slider'; // Single instance new ProductCardSlider('.product-slider', { showDots: true, showArrows: true, lazyLoad: true, }); // Or init all at once ProductCardSlider.initAll('.product-slider');
<script src="https://unpkg.com/product-card-slider"> </script> <script> ProductCardSlider.initAll('.slider', { hoverPreview: true, }); </script>
import { useRef, useEffect } from 'react'; import ProductCardSlider from 'product-card-slider'; function Card({ images }) { const ref = useRef(); useEffect(() => { const s = new ProductCardSlider(ref.current); return () => s.destroy(); }, []); return ( <div ref={ref}> {images.map(src => <img src={src} key={src} /> )} </div> ); }
Install in one command. No config files, no CSS imports, no build step required.