The carousel
widget allows organizing items into panels and flipping through them easily, showing only the active panel. The slideshow
adds auto-playing and navigation on top of the carousel
.
Carousel overview
The carousel widget structure
- carousel: the carousel widget, specified as:
- element with
data-widget="carousel"
- element with
- panel: the panels that contain the various items, specified as one of:
- elements with
role="group"
- using the
data-panels
option, specified as a jQuery selector relative to the widget - children of the 1st child of the widget if the controls are below the panels
- children of the 2nd child of the widget
- elements with
- item: the individual items in the carousel, specified as one of:
- elements with
role="option"
- using the
data-items
option, specified as a jQuery selector relative to the widget - children of the panels
- elements with
- controls: the controls that allow switching panels, specified as one of:
- elements with
role="toolbar"
, if thedata-controls
option is notfalse
- children of the 2nd child of the widget if the controls are below the panels
- children of the 1st child of the widget if the widget has several children
- auto-generated
- elements with
- previous button: the button that allows switching to the previous panel, specified as one of:
- elements with
data-role="previous"
, if thedata-prev
option is notfalse
- using the
data-prev
option, specified as a jQuery selector relative to the widget - auto-generated
- elements with
- next button: the button that allows switching to the next panel, specified as one of:
- elements with
data-role="next"
, if thedata-next
option is notfalse
- using the
data-next
option, specified as a jQuery selector relative to the widget - auto-generated
- elements with
Options for the carousel widget
data-event
: what event to respond to (click
by default)data-cycleItems
: whether to cycle through the items or not (true
orfalse
, default isfalse
)
Events for the carousel widget
beforeSelect
: triggered on the carousel element before the selection happensafterSelect
: triggered on the carousel element after the selection happens
Both events have the following parameters:
item
: a reference to the current itempanel
: a reference to the current panel
Default carousel
With inline preview
Inline previews for each option can be set, by adding:
data-target
: jQuery selector to the target element that contains the previewdata-url
: url to use for the content of the target element (for itssrc
attribute)
With controls
Vertical with controls
With custom controls
With custom controls and cycleItems=True
Slideshow
The slideshow widget structure
- slideshow: the carousel widget, specified as:
- element with
data-widget="slideshow"
- element with
- panel: same as carousel
- item: same as carousel
- controls: same as carousel
- previous button: same as carousel
- next button: same as carousel
- play button: the button that allows auto-playing the items, specified as one of:
- elements with
data-role="play"
, if thedata-play
option is notfalse
- using the
data-play
option, specified as a jQuery selector relative to the widget - auto-generated
- elements with
- pause button: the button that allows pausing the items, specified as one of:
- elements with
data-role="pause"
, if thedata-pause
option is notfalse
- using the
data-pause
option, specified as a jQuery selector relative to the widget - auto-generated
- elements with
- selectors: the selectors that allow jumping to a specific item, specified as one of:
- elements with
data-role="selector"
- using the
data-selectors
option, specified as a jQuery selector relative to the widget - auto-generated
- elements with
Options for the slideshow widget
Same as carousel, plus:
data-autoplay
: whether to auto-play the items (true
orfalse
, default istrue
)data-duration
: how long each item in the slideshow should be shown (in ms, default is5000
)
Events for the slideshow widget
Same as carousel.