开发者

trouble centering active slide in jcarousel

开发者 https://www.devze.com 2023-01-28 06:58 出处:网络
I have the slide show working exactly how I would like, except:开发者_如何转开发 To center the active thumbnail, you have to click on it twice, I would like it so that it only takes one click.

I have the slide show working exactly how I would like, except:

开发者_如何转开发

To center the active thumbnail, you have to click on it twice, I would like it so that it only takes one click.

The first 3 thumbnails, and last 3 thumbnails do not center, which is how I want it to work. I just want it so if the user clicks once on any thumbnail in-between those, it will center that thumbnail.

If anyone has any ideas, I'm all ears, this has been driving me crazy.

You can find a demo at: http://brettjankord.com/standards/slideshows/jslideshow-test2.php


Hmm, the trouble seems to be with the onBefore call, which .triggers the image-loaded.

I changed the initCallbackFunction to this:

function initCallbackFunction(carousel) {
    $('.jcarousel-item').click( function() {
         var idx = $('#mycarousel li a.activeSlide').data('index');
         carousel.scroll( idx-2 );
    });  
};

And removed the $('#advanced-slideshow').trigger('image-loaded'), and now it seems to work fine.

Fix shown here: http://jsfiddle.net/Xpc4c/show

0

精彩评论

暂无评论...
验证码 换一张
取 消