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

[enhancement] - Allow items to have variable sizes #26

Closed richardscarrott closed 11 years ago

richardscarrott commented 12 years ago

Useful when vertical carousel contains text

mpoulsen commented 12 years ago

This would also be useful when a horizontal carousel contains images with different widths.

Actually, for some time, I did not notice that my carousel was not working properly with images with varying width. It was only when I added a very narrow first element that the carousel stopped working. Looking at the _setRunnerWidth() I understand why.

Modifying _getItemDim() to return the average width (instead of the first elements width) worked for me. But maybe I overlooked something.

richardscarrott commented 12 years ago

Yeah, the _setRunnerWidth would need to be updated to check each item rather than just multiplying the width of the first by the number of items.

But for the carousel to properly support multiple widths the getItemsPerPage would have to take into account the fact that some pages might have less than others otherwise the carousel might end up skipping items.

I plan on looking into this when I get some time.

richardscarrott commented 11 years ago

Added in 0.10.7 - https://github.com/richardscarrott/jquery-ui-carousel/tree/0.10.7