Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

This is a documentation subpage for Carousel. It contains usage information, categories, and other content that is not part of the original template.

Purpose

Renders an image carousel with horizontal scroll-snap behaviour, prev/next buttons, keyboard navigation, swipe support, and a live slide counter. Designed to replace the native MediaWiki <gallery> on accession pages with heavy photo documentation.

Syntax

{{Carousel
| 1 = filename1.jpg
| 1cap = Caption for first image
| 1alt = Alt text for first image
| 2 = filename2.jpg
| 2cap = Caption for second image
| 2alt = Alt text for second image
}}

Parameters

The template accepts an unlimited number of slides via numbered parameters. Each slide uses three parameters sharing the same numeric prefix.

Parameter Required Description
N yes Filename of the image (without File: prefix). N is any positive integer.
Ncap no Caption displayed below the image.
Nalt no Alt text for screen readers and image-load fallback.

Numbering does not need to be contiguous. Slides are rendered in ascending numeric order regardless of input order.

Examples

Minimal

{{Carousel
| 1 = lin-pooh-flowering-01.jpg
| 2 = lin-pooh-flowering-02.jpg
| 3 = lin-pooh-flowering-03.jpg
}}

With captions and alt text

{{Carousel
| 1 = atolang-population-01.jpg
| 1cap = General population, mid-flowering, August 2025
| 1alt = Field of cannabis plants in flower at the Atolang site
| 2 = atolang-population-02.jpg
| 2cap = Individual plant showing typical morphology
| 2alt = Single cannabis plant photographed against forest background
}}

Behaviour

  • Images are served at 1200px thumbnail width with Retina srcset, not full resolution.
  • Off-screen images use native loading="lazy".
  • Clicking an image opens the file page (preserves download access).
  • Keyboard arrows, scroll, click, and swipe are all synchronised.
  • The first slide pins flush-left on open. Subsequent slides centre in the viewport. The last slide caps against the right edge of the track.
  • Minimum carousel height is 400px on desktop and 300px on mobile to prevent short images from collapsing the layout.

Implementation

  • Template invokes Module:Carousel, which iterates over all numeric parameters and emits a .lw-carousel-slide per image.
  • Styling lives in MediaWiki:Common.css under the .lw-carousel* class prefix. Site CSS is used rather than TemplateStyles because the MW 1.44 sanitiser rejects scroll-snap-*, scrollbar styling, and ::-webkit-scrollbar pseudo-elements.
  • JS controls (prev/next buttons, counter, scroll sync) live in MediaWiki:Common.js. The script is wired to mw.hook('wikipage.content') so it re-initialises on dynamic content. A dataset.lwInit flag prevents double-init.

See also