bs_append.bsplus_carousel {bsplus} | R Documentation |
Carousel
Description
A carousel is used to enclose a set of (typically) images, providing controls to move slides back-and-forth.
Usage
## S3 method for class 'bsplus_carousel'
bs_append(tag, content, caption = NULL, ...)
bs_carousel(id, use_indicators = FALSE, use_controls = TRUE)
Arguments
tag |
|
content |
character (HTML) or |
caption |
character (HTML) or |
... |
other args (not used) |
id |
character, unique id for accordion |
use_indicators |
logical, denotes use of slide-position indicators (dots) |
use_controls |
logical, denotes use of controls (chevrons at sides) |
Details
All of these functions return a bsplus_carousel
object
(which is also an htmltools::[tag][htmltools::tag]
, <div/>
), so you can
compose a carousel by piping. There are two parts to this system:
A constructor function for the carousel,
bs_carousel()
A function to append a slide to the carousel,
bs_append()
The verb append is used to signify that you can append an arbitrary number of slides to a carousel.
For the constructor, bs_carousel()
,
it is your responsibility to ensure that id
is unique
among HTML elements in your page. If you have non-unique id
's, strange things may
happen to your page.
Value
bsplus_carousel
object (htmltools::[tag][htmltools::tag]
,
<div/>
)
See Also
https://getbootstrap.com/docs/3.3/javascript/#carousel,
bs_carousel_image()
, bs_carousel_caption()
Examples
bs_carousel(id = "with_the_beatles") %>%
bs_append(content = bs_carousel_image(src = "img/john.jpg")) %>%
bs_append(content = bs_carousel_image(src = "img/paul.jpg")) %>%
bs_append(content = bs_carousel_image(src = "img/george.jpg")) %>%
bs_append(content = bs_carousel_image(src = "img/ringo.jpg"))