Configuration
The plugin accepts the following options:
Options can be set either on initialization or at runtime.
perPage
The number of carousel items per page or a function returning the number.
If perPage
is not set or null
, the plugin calculates the pages depending
on the number of visible carousel items.
Example
$('.jcarousel-pagination').jcarouselPagination({
'perPage': 3
});
Default
null
item
A function returning the markup for a page item of the pagination either as string or jQuery object.
The function will be called in the context of the plugin instance and receives two arguments:
- The page number.
- A jQuery object containing the carousel items visible on this page.
Example
$('.jcarousel-pagination').jcarouselPagination({
'item': function(page, carouselItems) {
return '<li><a href="#' + page + '">Page ' + page + '</a></li>';
}
});
Default
function(page, carouselItems) {
return '<a href="#' + page + '">' + page + '</a>';
}
carousel
The corresponding carousel as jQuery object.
This is optional. By default, the plugin tries to autodetect the carousel.
Example
$('.jcarousel-pagination').jcarouselPagination({
'carousel': $('.jcarousel')
});
Default
null