richardscarrott / jquery-ui-carousel

jQuery RS Carousel is a responsive and touch-enabled carousel written on top of jQuery and the jQuery UI Widget Factory providing a full and familiar API in less than 2.6kB minified and gzipped.
http://richardscarrott.github.io/jquery-ui-carousel/
192 stars 56 forks source link

multiple rows functionality in new version #61

Open superhector opened 11 years ago

superhector commented 11 years ago

Hi, i really like this plugin.i have been using older version for single row carousal but i need the carousal effect for multiple rows. I went through issues list and someone already reported this problem in new version and u answered it by saying that you will be wriiting extended plugin for the same. If you are already done with taht then please update the document else give me some suggestions how to make it useful for mutiple rows

richardscarrott commented 11 years ago

I've not got around to writing an extension to support multiple rows, partly due to the lack of time and partly because features such as variable width items and continuous support make it more difficult than it was in the old carousel.

In the meantime I'd recommend either outputting two items in each <li> or using the slave / master approach demonstrated here - https://github.com/richardscarrott/jquery-ui-carousel/issues/22

superhector commented 11 years ago

Thanks a lot!!!!..As of now, i used master/slave approach but there is a problem with this approach that if you will start dragging master widget conatiner then slave conatiner will get dragged in sync but vice versa is not true. so is ther any event through which i can detect which conatiner is being dragged(master or slave).once i come to know that if master is being dragged then i can bind 'before' event wit this and invoke slave and simillarly if slave is being dragged then can bind 'before' event with slave and invoke master.

richardscarrott commented 11 years ago

You could do something like this:

master.carousel({
    create: function () {
        $(this).find('.rs-carousel-runner').on('drag', function () {
            slave.find('.rs-carousel-runner').css('left', $(this).css('left')); // if using `translate3d` left will need to be changed for transform.
        });
     },
     before: function () {
          slave.carousel('goToPage', master.carousel('getIndex'));
     },
     touch: true
});

Thinking about this you'd then need to make the slave / master relationship a peer relationship as they both need to control one another (e.g. in case the 'slave' was swiped to the next or prev position).

It'd be fairly easy to do using the above as a starting point but to be honest I think outputting the mark-up with two items inside one <li> would simplify the whole issue and if you can't do that serverside then you could just manipulate the DOM before instantiating the carousel clientside.

martinbean commented 11 years ago

Hi. I could do with multiple rows adding back in too.