Vanilla Carousel
A carousel with zero dependencies — no GSAP, no slider library, no build step. The counterpart to STDR_001: where that one reaches for a library because momentum physics earns it, this one needs nothing at all. Frames stack and cross-fade — the CSS transition is the whole animation, running on the compositor, and the JavaScript only decides which frame is active. Keyboard accessible, swipeable, and respectful of reduced-motion preferences.
Specification
- ID
- STDR_002
- Status
- Developing — API may change until v1.0.0
- Stack
- Vanilla JS · CSS transitions · React port
- Dependencies
- None
- Licence
- MIT
- CodePen
- Fork on CodePen ↗
Quick start
<link rel="stylesheet" href="stdr-vanilla-carousel.css">
<div class="stdr-vanilla-carousel" data-stdr>
<div class="stdr-frames" data-stdr-frames>
<div>…</div>
<div>…</div>
</div>
<button data-stdr-prev>←</button>
<button data-stdr-next>→</button>
<div class="stdr-pagination" data-stdr-pagination></div>
<span data-stdr-count></span>
</div>
<script src="stdr-vanilla-carousel.js"></script>
<script>
new STDRVanillaCarousel('[data-stdr]', {
duration: 0.5, // cross-fade (s) — CSS does the animating
keyboard: true,
swipe: true, // pointer swipe / trackpad drag
pagination: true // dots, rendered into [data-stdr-pagination]
});
</script>
Notes
Canonical version is vanilla JS; the React port mirrors its behaviour and reuses the same stylesheet. Always wraps — a fade has no track to run out of. Frames stay mounted and stacked so images never re-fetch; frame sizing is fully controlled by your CSS. First proven as the product-frame pager in a client build, extracted here as a reusable component. Full API in the repo README.