PDA

View Full Version : jQuery Jcarousel automatically scroll circular items


StealthRT
04-08-2009, 04: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, 06: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?

keanechan
08-31-2010, 01:51 PM
Hello

I'm having the same problem....

We when i've entered wrap: 'circular', it moves off screen and does not wrap.

current URL is http://www.keanechan.com

Any help most grateful
Keane

aaronfay
10-06-2010, 10:21 AM
Hey all,

The problem is, even though wrap is set to circular, jCarousel turns off the automatic scrolling when it hits the end of the line. All you need to do is add an event listener that checks if the carousel is stopped and turn it back on.

You can get the code from my site (http://aaronfay.ca/content/post/jquery-jcarousel-circular-wrap-and-auto-scroll/).

Regards,
Aaron