Too many carousel items in jCarousel Lite v1.0.1

I’ve been working on a project and found the need for a carousel. After some searching I found a great script called jCarousel Lite. I found a bug with the implementation of jCarousel Lite v1.0.1 and how it uses selectors to get the number of li’s in a carousel. In my implementation I’m using list items within each carousel item. After looking at your code the following would result in jCarousel thinking that it has 3 items in the carousel when really there is only 1.

The current implementation of jCarousels use of $(‘li’, ul) in the constructor will return all nested li’s regardless of how deeply nested they are in the dom structure. To handle this issue I’ve modified a few lines of code in the constructor to fix this issue. Feel free to apply these changes if you see fit.

Here’s the original snippet:

Here is my modified version:

March 30, 2011
8:11 pm
Tags: , ,