Basic example
Use these default button styles with multiple colors to indicate an action or link within your website.
![Table Full of Spices](https://mdbcdn.b-cdn.net/img/Photos/Thumbnails/Slides/1.webp)
![Winter Landscape](https://mdbcdn.b-cdn.net/img/Photos/Thumbnails/Slides/2.webp)
![View of the City in the Mountains](https://mdbcdn.b-cdn.net/img/Photos/Thumbnails/Slides/3.webp)
Image optimization
To ensure the proper performance of the page, it is recommended to include
thumbnails of images in the src attribute. Then in the
data-twe-img
attribute add the path to the image with higher resolution. If the
data-twe-img
attribute is omitted, the lightbox will display
the same image as in the reduced size.
Shadows and rounded corners
You can improve the look of the images by adding shadows and rounded corners.
![Table Full of Spices](https://mdbcdn.b-cdn.net/img/Photos/Thumbnails/Slides/1.webp)
![Winter Landscape](https://mdbcdn.b-cdn.net/img/Photos/Thumbnails/Slides/2.webp)
![View of the City in the Mountains](https://mdbcdn.b-cdn.net/img/Photos/Thumbnails/Slides/3.webp)
Different sizes
Loaded images can have any aspect ratio. Their size will be automatically adjusted to the window when you open the lightbox.
![Table Full of Spices](https://mdbcdn.b-cdn.net/img/Photos/Thumbnails/Slides/1.webp)
![Coconut with Strawberries](https://mdbcdn.b-cdn.net/img/Photos/Thumbnails/Square/1.webp)
![Dark Roast Iced Coffee](https://mdbcdn.b-cdn.net/img/Photos/Thumbnails/Vertical/1.webp)
Zoom level
The data-twe-zoom-level
attribute allows you to define the size
of a single zoom in / zoom out.
![Table Full of Spices](https://mdbcdn.b-cdn.net/img/Photos/Thumbnails/Slides/1.webp)
![Winter Landscape](https://mdbcdn.b-cdn.net/img/Photos/Thumbnails/Slides/2.webp)
![View of the City in the Mountains](https://mdbcdn.b-cdn.net/img/Photos/Thumbnails/Slides/3.webp)
Disabled image
By adding a data-twe-lightbox-disabled
attribute to any image,
you can exclude it from your lightbox. In the example below, the third image
has been disabled.
![Table Full of Spices](https://mdbcdn.b-cdn.net/img/Photos/Thumbnails/Slides/1.webp)
![Winter Landscape](https://mdbcdn.b-cdn.net/img/Photos/Thumbnails/Slides/2.webp)
![Disabled image](https://mdbcdn.b-cdn.net/img/Photos/Thumbnails/Slides/3.webp)
![Place Royale Bruxelles](https://mdbcdn.b-cdn.net/img/Photos/Thumbnails/Slides/4.webp)
Captions
Image captions can be added using the
data-twe-caption
attribute. If it is not set, the data is taken
from the alt
attribute. When you want to disable caption, leave
the data-twe-caption
empty.
![Table Full of Spices](https://mdbcdn.b-cdn.net/img/Photos/Thumbnails/Slides/1.webp)
![Winter Landscape](https://mdbcdn.b-cdn.net/img/Photos/Thumbnails/Slides/2.webp)
![View of the City in the Mountains](https://mdbcdn.b-cdn.net/img/Photos/Thumbnails/Slides/3.webp)
Outside access
The lightbox can be successfully operated via JavaScript. There are many
public methods available such as open
, slide
,
zoomIn
, zoomOut
, or close
. All are
described in the API tab.
![Table Full of Spices](https://mdbcdn.b-cdn.net/img/Photos/Thumbnails/Slides/1.webp)
![Winter Landscape](https://mdbcdn.b-cdn.net/img/Photos/Thumbnails/Slides/2.webp)
![View of the City in the Mountains](https://mdbcdn.b-cdn.net/img/Photos/Thumbnails/Slides/3.webp)
If you are looking for more advanced options, try Bootstrap Lightbox from MDBootstrap.