jsor / jcarousel

Riding carousels with jQuery.
https://sorgalla.com/jcarousel/
MIT License
1.99k stars 736 forks source link

jcarouselAutoscroll does not work when you have 2 carousel simultaneously #686

Closed kafeltz closed 10 years ago

kafeltz commented 10 years ago

If you have 2 separated div with their own class (divs). The plugin will always return the first jcarousel instance.

I could not make it work on fiddle, but you can see in this temporary page: http://haai.com.br/paroquia/

On jcarousel plugin source code i put a console.log(this) to show the instance is wrong.

I have two separated carousel with:

tldr: it auto-start-scrolling the wrong caroussel!

this: $('.jcarousel-banner'); auto-starts the other one: $('.jcarousel');

kafeltz commented 10 years ago

i'm so sorry, i managed to make it work.

wrong:

    var jcarousel = $('.jcarousel-banner');
    jcarousel.jcarouselAutoscroll({
        interval: 1000,
        target: '+=1',
        autostart: true
    });

right:

    var jcarousel = $('.jcarousel')
    .jcarousel({
        // Core configuration goes here
    })
    .jcarouselAutoscroll({
        interval: 3000,
        target: '+=1',
        autostart: true
    })