PDA

View Full Version : jQuery Jcarousel automatically scroll circular items


StealthRT
04-08-2009, 03:55 AM
Hey all i need help modifying my code below in order to have my carousel automatically continue when it reaches the end. The code works just fine as-is but it goes back to the first image after it ends... I do not really want that, i just want it to continue without going back.


function mycarousel_initCallback(carousel)
{
carousel.clip.hover(function() {
carousel.stopAuto();
}, function() {
carousel.startAuto();
});
};

jQuery(document).ready(function() {
jQuery('#mycarousel').jcarousel({
auto: 3,
//wrap: 'circular',
wrap: 'last',
initCallback: mycarousel_initCallback
});
);


ex:

image1 -> image2 -> image3 -> image4 -> image1 -> image2...

INSTEAD OF DOING THIS:
image1 -> image2 -> image3 -> image4 -> loops back to image1 <-

I do not know how to add both "last" and "circular" to the wrap properties.

The website is here for the jCarousel: http://sorgalla.com/jcarousel/

Any help would be great!

David

Iszak
04-14-2009, 05:57 AM
I'm not entirely sure what's the problem - I understand you don't want it to scroll back to the first image, you want it to keep rotating around, so after the last one you have the first one again. Well you've just got to set

jQuery(document).ready(function() {
jQuery('#mycarousel').jcarousel({
auto: 3,
wrap: 'circular',
initCallback: mycarousel_initCallback
});
);

There's no need for wrap: 'last', or is there something else?