Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Next, we want to set up the function that will create the next button, previous button, and pagination buttons and makes them work.
initCallback that will allow us to pass in the name of a function that should be called when the carousel is created. Let's get started by creating an empty function and calling it:var slider = $('#featured-carousel');
function carouselInit(carousel) {
// Our function goes here
}
$(document).ready(function(){
slider.jcarousel({
scroll: 1,
buttonNextHTML: null,
buttonPrevHTML: null,
initCallback: carouselInit
});
});
Whatever actions we write inside of our carouselInit() function, it will be
executed when the carousel is initialized or set up. Since any page numbers and
previous and next buttons would only be functional if JavaScript is enabled, we want
to create those buttons dynamically with JavaScript rather than coding them in our
HTML. Let's take a look at how we can create a list of page links to each slide in the
slider.