Overview

Carousel

A scroll-snap strip with drag, loop and autoplay, built on your own markup.

Get started

Drag with a mouse, swipe, or focus the strip and use ←→. Images open in the lightbox.

Principles

  • Let the browser scroll. Touch and trackpads scroll natively with CSS scroll snap, and every move from code is a scroll too.

  • Never let a drag click. A mouse drag never opens the link under it, an ordinary click still works, and touch stays native.

  • Repeat without clones. The loop moves the original slides, so ids, links and buttons stay unique, and it turns on only when the slides can cover the viewport.

  • Let autoplay wait for people. Autoplay pauses for hover, focus, dragging, hidden pages, offscreen strips and reduced motion.

  • Keep keys local. Arrow keys act only inside the focused strip and swap sides in right-to-left layouts.

  • Put back what it moved. Destroy cancels timers and restores the styles, transforms and listeners it added.