1. Create the carrotCell markup. By default everything must be contained in the element .carrotCell, which contains a .carrotCellView that is the parent to another container with the items being its children. The controls are also assumed to be contained inside .carrotCell. The markup can be changed, please refer to the layout flexibility demo and the documentation.
The default carrotCell is horizontal and advances by how many is visible in the current view port.
prev
next
5.a.1 Define a fixed width for .carrotCell and/or .carrotCellView, then define a fixed width for the scrolling items. These values are used in the horizontal scroll calculations.
.carrotCell { width: 560px; } // set the width of the over all carrotCell
.carrotCellView { width: 500px; } // set the width of the clipping pane
.carrotCellView li { width: 100px; } // set the width of each scrolling item
5.a.2 Call carrotCell() on the .carrotCell container element.
$(".carrotCell").carrotCell();
Fall Back State (No Javascript)
This is what the horizontal carousel look like without any javascript methods being called to create the carrotcell. Note that the previous, next, and all javascript related control buttons buttons are hidden by default through carrotcell.css.
This carrotCell scrolls vertically instead of horizontally. The mark up used in the vertical carrotCell is exactly the same as the horizontal one, the only difference is changes in the CSS.
5.b.1 Create the styles to lay out the .carrotCell and children correctly.
.carrotCell { width: 180px; } // make it narrow
.carrotCell .carrotCellView { height: 260px; } // set the height of clip
.carrotCellView li{ height: 260px; } // set the height of each element
...
5.b.2 Set the parameter sideways to be the boolean false
$('.carrotCell').carrotCell({ sideways: false });
Fall Back State (No Javascript)
This uses the overflow:auto property of the .carrotCellView container when Javascript is not available.