Zero dependencies · ~3 KB

Drag scrolling that
feels buttery smooth

Add drag-to-scroll, center snapping, and infinite loop to any horizontal container. Keep your own markup and styles — just enhance scrolling.

$ npm install drag-scroll-carousel
index.js
import DragCarousel from 'drag-scroll-carousel';

const carousel = new DragCarousel('#product-strip', {
  speed:         1.5,
  centerMode:    true,
  loop:          true,
  slideSelector: '.card',
  buttons:       { prev: '#prev', next: '#next' },
});

// Cleanup when done
carousel.destroy();
Try it — drag, swipe, or use the arrows
Everything you need, nothing you don't

Drag to Scroll

Native-feeling pointer-based scrolling with configurable speed multiplier.

Center Mode

Snaps to the nearest slide and centers it after drag ends. Buttons move by slide.

Infinite Loop

Seamless looping by cloning slides. Works even with very small slide sets.

👆

Touch + Mouse

Pointer events work on desktop and mobile. No separate touch handler needed.

Lightweight

~3 KB total. Zero dependencies. Ships as a single class you can drop anywhere.

Framework Agnostic

Use with vanilla JS, React, Shopify Liquid, or any HTML. Includes destroy() for cleanup.

Simple, predictable options
OptionTypeDefaultDescription
speed number 1.5 Pointer-movement to scroll multiplier
buttons object | null null { prev, next } — any valid querySelector string
centerMode boolean false Snap to nearest slide and center it
loop boolean false Infinite looping with cloned slides
slideSelector string | null null Selector for slides (defaults to direct children)
minLoopSlides number 3 Min visual slide count for loop cloning

Start building in 30 seconds

One install. One class. Drop it into any project and scroll beautifully.

$ npm install drag-scroll-carousel

Works everywhere

React
Vanilla JS
Next.js
Shopify
CDN / HTML