Carousel
The Bootstrap carousel component, implemented in Ruby. Use it like any other matestack component in your apps, pages and components. It offers customizable options to simply achieve what is possible in bootstrap with this component. See below for more information about the possible options.
bs_carousel(*args, &block)
bs_carousel(*args, &block)Returns a bootstrap carousel containing a hash of items with path, title, text and interval. Also the carousel is customizable with the following options.
Optional options
:controls- If settrue, the previous and next arrows will be visible:indicators- If settrue, the bottom indicators will be visible:fade- If settrue, the animation when switching between items will be faded animation instead of sliding animation:start- Set the active item for carousel at the beginning. Counting start at 0.:variant- If:dark, the dark carousel theme will be applied (using css class carousel-dark):cycle_on- Cycles through the carousel items from left to right.:pause_on- Stops the carousel from cycling through items.:prev_on- Cycles to the previous item.:next_on- Cycles to the next item.Html attributes - all w3c confirm html attributes for div's can be set via options and will be added to the surrounding carousel div.
Further explanation
:itemsarray: each item can include a hash withpath,title,textandintervalwherepathis the image-url,intervalis the amount of time to delay between automatically cycling to the next item,titleandtextis the caption of the item:cycle_on,:pause_on,:prev_on,:next_onare JavaScript behaviors which can be trigger for example by an onclick method
Examples
Example 1: Basic Carousel with 2 items
returns
Example 2: Basic Carousel with captions and different interval
returns
Example 3: Using controls, indicators and faded animation
returns
Example 4: Trigger Carousel per event
with cycle_on, pause_on, prev_on, next_on you can trigger the JavaScript behaviors of carousel per event
cycle_on and pause_on can be use similarly as the exmample with prev_on and next_on below
Last updated