Multi item carousel
Bootstrap 5 Multi item carousel plugin
An advanced slideshow component for cycling through images with a selectable number of active items.
Responsive Multi item carousel built with the latest Bootstrap 5. Many practical examples like lightbox integration, Vertical, autoplay, and many more.Note: Read the API tab to find all available options and advanced customization
Note: Currently, the plugin is only compatible with the basic MDB package imported in UMD format. More about import MDB formats.
Basic example
A basic example of a multi carousel with the most common use case with 3 active items (default version).
Vertical example
To enable vertical mode just add vertical
class to the wrapper element.
Lightbox integration
Wrap carousel with a div.lightbox
element to enable lightbox.
To ensure the proper performance of the page, it is recommended to include thumbnails of
images in the src attribute. Then in the
data-mdb-img
attribute add the path to the image with higher resolution. If the
data-mdb-img
attribute is omitted, the lightbox will display the same image as in
the reduced size.
Active items
Set a data-mdb-items
attribute to change the number of active images.
Breakpoint
To change breakpoint on small devices easily set
data-mdb-breakpoint
value (default value is 992). Set to false
to
disable responsiveness.
Autoplay
Set a data-mdb-interval
attribute to enable autoplay.
Multi item carousel - API
Import
Usage
Via data attributes
Using the Multi Item Carousel plugin doesn't require any additional JavaScript code - simply add
data-mdb-multi-carousel-init
attribute to
.multi-carousel
and use other data attributes to set all options.
Via JavaScript
Via jQuery
Note: By default, MDB does not include jQuery and you have to add it to the project on your own.
Options
Options can be passed via data attributes or JavaScript. For data attributes, append the option name to
data-mdb-
, as in data-mdb-breakpoint=""
.
Name | Type | Default | Description |
---|---|---|---|
items
|
Number | String | 3 |
Defines number of visible items. |
breakpoint
|
Number | String | Boolean | 992 |
Defines window breakpoint in px to show only one item. Set to
false to disable.
|
interval
|
Number | String | Boolean | false |
Defines autoplay interval. Disabled as a default. |
Methods
Name | Parameters | Description | Example |
---|---|---|---|
init |
Initializes multi carousel. | instance.init() |
|
slideNext
|
Slides to the next item. |
instance.slideNext()
|
|
slidePrev
|
Slides to the previous item. |
instance.slidePrev()
|
|
dispose
|
Removes the MultiCarousel instance. |
instance.dispose()
|
|
getInstance
|
element | Static method which allows to get the carousel instance associated with a DOM element. |
MultiCarousel.getInstance(element)
|
Events
Name | Description |
---|---|
slide.mdb.multiCarousel
|
Emitted when a multiCarousel has been slid. |
slid.mdb.multiCarousel
|
Emitted after an image slide. |