ryrych / rcarousel

yet another jQuery UI carousel
http://ryrych.github.com/rcarousel/
171 stars 48 forks source link

carousel not works with one more instance at same page #65

Open davirs opened 11 years ago

davirs commented 11 years ago

this carousel not works with more then one instance of carousel.

for example, if you have 3 carousels at your page, only the first carousel works. The other two execute the commands of the first instance only.. prev and next button for example...

rajanRawat commented 11 years ago

that is beacuase in the CSS and javascripts they use id's as "#carousel".

try changing all such instances into classes ".carousel". It should work then.

romuloinnocencio commented 8 years ago

Like said rajanwat, yes it works. Here i have 3 instances os them and works fine with class.

var $wrapper = $('.js-rcarousel');

        $wrapper.each(function () {

            var options = {
                width: 140,
                margin: 38,
                visible: 4,
                step: 1,
                orientation: "horizontal"
            }

            var type = $(this).attr('data-type');

            if (type == 'galeries') options.height = 135;
            else if (type == 'movies') options.height = 163;

            else if( type == 'eventos' ){
                options = {
                    width: 470,
                    margin: 0,
                    height: 137,
                    visible: 4,
                    step: 1,
                    orientation: 'vertical'
                }
            }

            $(this).rcarousel(options);

        });