Components
Carousel
Slides you swipe, drag or step through — banners, product shelves, testimonials. Built on native scroll snapping, so touch and trackpads feel right even without JavaScript.
<div class="carousel" aria-label="What's new" data-moey-autoplay="5000" data-moey-loop>
<div class="carousel-track">
<div class="carousel-item">
<img src="pro.jpg" alt="">
<div class="carousel-caption">
<h3>Moey Pro is here</h3>
<p>Reports, roles and unlimited stores.</p>
</div>
</div>
<div class="carousel-item">…</div>
</div>
</div>
- Swipe on touch screens and trackpads, drag with a mouse, or use the arrows, the dots, or ← → (and Home / End) once it has focus.
- Autoplay (
data-moey-autoplay="5000") pauses while the pointer or keyboard focus is on it and in a background tab, stops once you take control, and has a pause button. People who prefer reduced motion don't get it at all. - Screen readers hear a carousel with "slide 2 of 4"; slides out of view are skipped by Tab.
Several at a time
.carousel-3 shows three on large screens, two on tablets and one on phones (also -2, -4, or set --mo-carousel-per-view). .carousel-peek lets a bit of the next one show, so people know there's more.
Moey Mug
$12.00
Moey Tote
$16.00
Moey Cap
$20.00
Moey Hoodie
$24.00
Moey Notebook
$28.00
Moey Poster
$32.00
Moey Socks
$36.00
Moey Apron
$40.00
<div class="carousel carousel-3 carousel-peek" aria-label="Best sellers">
<div class="carousel-track">
<div class="carousel-item card">…</div>
…
</div>
</div>
Testimonials
Dots only: data-moey-arrows="false". Any content works inside a slide.
“The packaging alone made me order again. Everything arrived perfect.”
“Fast, friendly, and the mugs are even nicer in person.”
“A chipped handle was replaced the same day. Great service.”
<div class="carousel" data-moey-arrows="false">…</div>
From code
const c = Moey.carousel('#banners');
c.next(); c.prev(); c.goTo(2);
c.play(); c.pause();
c.index; // the current slide
el.addEventListener('moey:slide', (e) => e.detail.index);
| Class / attribute | What it does |
|---|---|
.carousel > .carousel-track > .carousel-item | The structure. Give the carousel an aria-label |
.carousel-2 · -3 · -4 · --mo-carousel-per-view | Slides at a time (fewer on smaller screens) |
.carousel-peek · --mo-carousel-peek · --mo-carousel-gap | Show part of the next slide · how much · the space between |
.carousel-caption | Text over the bottom of a slide |
data-moey-autoplay="5000" · data-moey-loop | Advance every 5 s (with a pause button) · wrap around at the ends |
data-moey-arrows="false" · data-moey-dots="false" · .carousel-controls-inside | No arrows · no dots · arrows over the slides instead of on the edges |