Image viewer 2 is an accessible, configurable component providing options for showing an image slideshow
and/or a lightbox viewer with navigation between images.
Örebro Castle
Karlslund Manor House
Highland cattle at Oset outside Örebro
Features include
Buttons for displaying the previous and next slides.
Button for stopping and restarting rotation.
Keyboard navigation support.
Aria-live announcement for image changes.
Optional automatic rotation, always disabled for users who prefers reduced motion.
Optional download button in lightbox.
Optional placement of slideshow buttons.
Lightbox
Use attribute data-zoom on one or more links inside the element being initialized from script. The lightbox opens
with navigation arrows to switch between images. The link href:s should point to a large version of the image being
shown.
<divid="example-imageviewer2-1"class="example-imageviewer2-images"><ulclass="env-list env-cardholder-grid"style="--env-cardholder-grid-column-width: 10em;"><li><buttontype="button"aria-label="Zoom image: Dry grass in sunlight"data-href="/placeholders/originals/03.webp"data-zoom><imgloading="lazy"src="/placeholders/225x100/03.webp"data-figcaption="A strand of grass catching the warm glow of the sun"alt="Dry grass in sunlight"/></button><pclass="env-text-caption-01">Dry grass in sunlight</p></li><li><buttontype="button"aria-label="Zoom image: Bright green fern leaves"data-href="/placeholders/originals/04.webp"data-zoom><imgloading="lazy"src="/placeholders/225x100/04.webp"alt="Bright green fern leaves"data-figcaption="Bright green fern fronds filling the frame in soft light"/></button><pclass="env-text-caption-01">Bright green fern leaves</p></li><li><buttontype="button"aria-label="Zoom image: Two little snails on a green leaf"data-href="/placeholders/originals/08.webp"data-zoom><imgloading="lazy"src="/placeholders/225x100/08.webp"data-figcaption="Two little snails hanging out on a green leaf in the shade"alt="Two little snails on a green leaf"/></button><pclass="env-text-caption-01">Two little snails on a green leaf</p></li><li><buttontype="button"aria-label="Zoom image: A close-up of a dandelion"data-href="/placeholders/originals/09.webp"data-zoom><imgloading="lazy"src="/placeholders/225x100/09.webp"data-figcaption="A close-up of a dandelion ready to spread its seeds on a sunny day"alt="A close-up of a dandelion"/></button><pclass="env-text-caption-01">A close-up of a dandelion</p></li></ul></div>
Optionally wrap the image in a link pointing to the larger image. The href attribute will be used for zoom
and data-zoom should be added to the link, not the image.
// Default options{slides:false,buttons:{download:true,showText:false,},i18n:'sv',}// Default slides options if set to true{auto:0,speed:300,draggable:true,playing:false,overlay:true,buttons:{type:null,ghost:false,size:null,},},
buttons{ download, showText }
Lightbox button options. Show/hide download button. Visible text in close/download buttons.
Translation of buttons aria-label and aria-roledescription.
Use predefined strings (swedish, english or norwegian) or write your own translation. Default is 'sv'.
Available language keys: roledescription, prev, next, pause, play, slideshow, zoom, largeImage, close, download,
image, of