Customization
For further customization, be sure to take a look at the SlideshowLightbox documentation, which lists the various customization options and props you can update to edit the theme and so forth.
Get 20% off with our latest discount. For a limited time only!Get 20% off with our latest discount. For a limited time only!
Lightbox.js supports the HTML5 picture
element, and in this guide, we'll be taking a look at how to display this element in the lightbox.
Let's get started! First, we'll need to import the SlideshowLightbox
component:
import {SlideshowLightbox} from 'lightbox.js-react'
Next, let's initialize the metadata that contains the relevant information and links needed to render the picture tag:
let media = [
{"picture": {
'image/webp': {
srcSet: 'Image URL here',
sizes: '100vw'
},
'image/jpeg': {
srcSet: 'Image URL here',
sizes: '100vw'
},
'fallback': 'Image URL here'
}
}];
Just remember to add your image URLs to the above code for the srcSet properties, as well as the fallback
property too.
Then just pass this array to the images
prop in the SlideshowLightbox
component.
<SlideshowLightbox images={media} lightboxIdentifier="lbox1" showThumbnails={true}>
{media.map(item => {
return <img src={item["picture"]['image/jpeg'].srcSet} data-lightboxjs="lbox1" />
})}
</SlideshowLightbox>
For further customization, be sure to take a look at the SlideshowLightbox documentation, which lists the various customization options and props you can update to edit the theme and so forth.