Configurations
Example of a carrotCell object with configurations:
var myCarouselAPI = $('#myCarousel').carrotCell({
sideways: false,
delay: 3000,
key: true,
navi: true,
step:1,
auto: true
});
Basic Configuration
The configuration options are passed into the carrotCell as an object on creation.
Config Property | Property Type | Example | Description | Default |
---|---|---|---|---|
step | integer | 5 |
How many items to advance by, if not set, the items to advance by is assumed to be all current visible elements in the container. Step should be smaller than the number of total items and smaller than or equal to all visible elements in the container. |
Number of visible items |
sideways | boolean | false |
By default makes a horizontal scroller. Set to false to create a vertical or up and down scroller. Note your CSS must support this layout. |
true |
infinite | boolean | true |
On reaching the end of the carousel, show from start again without rewinding. |
false |
auto | boolean | true |
Make the carousel automatically scroll forward on a timer. This will make the carousel infinite by default. |
false |
delay | integer (milisecs) | 9000 |
The time delay between auto scrolling of each page. |
5000 |
speed | integer (milisecs) | 9000 |
The speed at which the carousel does its scroll animation. |
500 |
navi | boolean | true |
Indicate that an external navigation is included. The number of navi items created must correspond to the number of pages used if not using makeNavi. There must be an element of class .navi in the HTML with direct descendent children used as each navigation item inside. |
false |
makeNavi | boolean | false |
Generate the paging navigation automatically. The container for navi must already exist and have the .navi class. |
false |
stopOnClick | boolean | true |
Stop auto advance when a navi element is clicked. |
false |
pauseOnHover | boolean | true |
Stop auto advance when the mouse is hovering over the carousel. |
false |
key | boolean | true |
Turn on or off arrow key navigation for carousel. Up and Down arrows work for vertical carousels, and Left and Right arrows for horizontal. Note that since key events are document based all carousels would recognize the event. |
false |
containsControl | boolean | false |
Indicates wether the carrotCell controls are contained inside .carrotCell or elsewhere in the DOM. Set the property controlScope (see below for Selector Configurations) to designate a new scope If there is no controlScope set, the body is assumed to be the new scope of controls. |
true |
carrotDone | function |
carrotDone: function(api){
|
A custom call back after the carrotCell has been initialized. By default it is passed the API object of the carrotCell. |
Class Configuration
Some default utility class names can be changed by passing in a new class name. This property does not accept selectors, only string class names. These settings are also passed in on creation of the carrotCell object.
Config Property | Example | Description | Default |
---|---|---|---|
disabledClass | "off" |
The class added to previous and next when no action is possible. This is added to the controls when the end of the list of items is reached. |
"disabled" |
currentClass | "on" |
The classname for the currently selected child of the navi. |
"current" |
cloneClass | "twin" |
The classname for the currently selected child of the navi. |
"clone" |
naviClass | "dot" |
The classname for the individual navi page items. |
"naviItem" |
Events
Event names can be customized for versatility. The Event Literal is passed by the event information object to help identify what the original event is despite any name changes.
Setting Name | Description | Event Default Name | Event Literal | Values Returned |
---|---|---|---|---|
scrollStart |
Signal that the carousel has started its scrolling animation. |
"carrotScrollStart" | "scrollStart" | carrotCellName, eventLiteral, currentPageNumber |
scrollEnd |
Signal that the carousel has ended its scrolling animation. |
"carrotScrollEnd" | "scrollEnd" | carrotCellName, eventLiteral, currentPageNumber |
atStart |
Signal that the carousel has reached its starting point. |
"carrotAtStart" | "atStart" | carrotCellName, eventLiteral, |
atEnd |
Signal that the carousel has reached its ending point. |
"carrotAtEnd" | "atEnd" | carrotCellName, eventLiteral, |
onPlay |
Signal that the carousel is currently on auto scroll. |
"carrotPlay" | "onPlay" | carrotCellName, eventLiteral, |
onPause |
Signal that the carousel is currently paused on auto scroll. |
"carrotPause" | "onPause" | carrotCellName, eventLiteral, |
onStop |
Signal that the auto scroll on carousel is currently disabled. |
"carrotStop" | "onStop" | carrotCellName, eventLiteral, |
onInsert |
Something has been inserted into the carrotCell. |
"carrotInsert" | "insert" | carrotCellName, eventLiteral, totalPages |
onRemove |
A carrotCell item has been removed. |
"carrotRemove" | "remove" | carrotCellName, eventLiteral., totalPages |
onEmpty |
The carrotCell now contains no items. |
"carrotEmpty" | "empty" | carrotCellName, eventLiteral |
onReload |
The carrotCell has been reloaded with completely different content |
"carrotReload" | "reload" | carrotCellName, eventLiteral, pages |
pagesChanged |
The number of pages have changed based on insert, remove, or reload. |
"carrotPageCountChanged" | "pagesChanged" | carrotCellName, eventLiteral, currentPageCount, previousPageCount |
Selector Configuration
Default selectors can be over-ridden by passing in a new jQuery selector string. Note that most selectors operate inside .carrotCell unless the controlScope and the containsControl property.
Config Property | Scope | Example | Description | Default |
---|---|---|---|---|
sliderSelect | .carrotCellView | "div" |
This contains all the slides and is inside .carrotCellView. This selector selects the first encountered selection Only the first div inside .carrotCellView is selected in the example case. |
"ol" |
sliderChildSelect | sliderSelect | "div" |
This is the child slide of Slider and is contained in sliderSelect This selector selects all children of this type inside sliderSelect |
"li" |
controlScope | "body" or custom | "#controlUnit" |
This is the scope where the carrotCell controls live. It will only be used if containsControl is set to TRUE. If containsControl is set to TRUE and no controlScope is provided, the default is "body" |
current ".carrotCell" |
prevSelect | controlScope | "#controlUnit .previously" |
Advance the carrotCell backward if applicable |
".prev" |
nextSelect | controlScope | "article .nextly" |
Advance the carrotCell forward if applicable |
".next" |
pauseSelect | controlScope | "#controlUnit .pause" |
Pause the autoplay. |
".pause" |
playSelect | controlScope | "#play" |
Resume the autoplay. |
".play" |
stopSelect | controlScope | "section .stop" |
Stop the autoplay. |
".stop" |
naviSelect | controlScope | "#navigation li.naviThing" |
The selection of individual clickable items inside the navi that advances the pages as determined by step parameter of the carousel. |
"> *" |
naviContainer | controlScope | ".myspecialnavi" |
The container that houses the navi. |
".navi" |
Inline Configuration
Config Property | Example | Description | Default |
---|---|---|---|
naming the navi items in makeNavi mode | <div class="navi" data-navi='["item 1", "item 2"]'></div> |
Instead of the default 1...n add names to the navi individual items by passing it as a data attribute. If only 2 names are passed and there are 4 pages, it will appear as "item 1, item 2, 3, 4, 5" etc with the passed in transposed over the default. |
1,2,3...n |