JCarousel显示问题
我想在 jcarousel 中显示大约 6 个项目,问题是每当 jcarousel 可用的项目少于 6 个,它只是与 项目。例如,如果我有 3 个项目,它们会相互重叠或相距很远。
我做错了什么?如果帧数超过 6 个,我已将项目计数、可见属性设置为最大值 6,如果帧数较少,则设置为小于 6。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要使用
visible
,它几乎没有用。只需设置轮播的宽度即可显示所需数量的项目。由于轮播在 jCarousel 初始化之前不存在,并且在初始化时必须具有正确的宽度,因此您需要从 CSS 执行此操作 - 如果您想要非恒定数量的元素,则需要从 PHP 动态创建 CSS或来自 JavaScript。这是执行后者的小提琴: http://jsfiddle.net/qth8n/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/