How do I manually slide a carousel? I am using jCarousel as below:

jcarousel_add('#jcarousel',
  array('vertical' =&gt; false, 'scroll' =&gt; 3, 'horizontalDirection' =&gt; $direction, 'initCallback' =&gt; 'slCarousel_initCallback')
);


How can I manually slide the carousel?

When I run jQuery("#jcarousel").jcarousel().next();, in Firebug I get the following:


>>> jQuery("#jcarousel").jcarousel().next();
[]


I have tried this as well in the Firebug console:


var carousel = jQuery("#jcarousel").data('jcarousel');
//alert (carousel);
carousel.next();


I got the following:


>>> var carousel = jQuery("#jcarousel").data('jcarousel'); carousel.next()
TypeError: carousel is undefined
I fixed it by creating a global variable, and then assigning the value of the carousel to it.

var global_jc="";
function slCarousel_initCallback(carousel) {
  global_jc=carousel;
  // ...
}


Wherever I want to use next(), I use the following code:

global_jc.next();