收录日期:2020/01/29 14:13:25 时间:2010-10-04 17:58:40 标签:javascript,jcarousel

I want to display about 6 items in a jcarousel, the problem is that whenever there are less than 6 items available to the jcarousel, it simply overlaps the items. Like, if I have 3 items, they get overlapped on each other or separates them far apart.

What I am doing wrong ? I have set the item count, visible properties to either max of 6 if we have more than 6 frames, or less than six for lesser frame count.

Don't use visible, it's mostly useless. Just set the width of the carousel to show as many items as required. Since the carousel does not exist until jCarousel is initialized, and it must have the right width upon initialization, you need to do this from CSS - if you want a non-constant number of elements, you need to create your CSS dynamically either from PHP or from Javascript. Here is a fiddle that does the latter: http://jsfiddle.net/qth8n/