i try to control a carousel with additional links on a page.
i'm aware of #1058028: Add guard-class and prevent JS error when using certain jCarousel options

tried already a lot to access the object, and this seems to work

for (var key in Drupal.settings.jcarousel.carousels) {
        // only got one carousel - so the it will loop once .. ;)
    	var options =  Drupal.settings.jcarousel.carousels[key];
    	$(options.selector).jcarousel(options).scroll(jCindex); //is supposed but doesn't work ..
        $(options.selector).data('jcarousel').scroll(jCindex); // works a half & data() is not really cross-browser ..
}

but ends up in strange behavior when i click the next/prev buttons in the carousel ...

tried also to bind click events in the initCallback, but this method is never called,
probably related to #1058028: Add guard-class and prevent JS error when using certain jCarousel options

any suggestions / directions .. ?

thx

Comments

quicksketch’s picture

This is a question about how to use the library more than support request about how to use the module. I suggest reading the library documentation at http://sorgalla.com/projects/jcarousel/

Commands are typically executed with something like this: $(options.selector).jcarousel('scroll', jCindex);.

ytsurk’s picture

Status: Active » Closed (works as designed)

believe me - i looked a lot there .., and tried even more .., somehow got blind ..
you're absolutely right; this belongs to the jCarousel functionality -
thanks for opening my eyes anyway,
exactly what i needed and it works - cross browser :D

my solution now is, as suggested:

$(options.selector).jcarousel('scroll', jCindex);

make shure to:

var jCindex = jQuery.jcarousel.intval(getMeAnIndex());

parseInt resolved strange scrolling behavoir.

interesting read (give true as second argument to the scroll method if used directly)

till combinations combinate to the fullest,
combine as much as you can ..