如何在响应式jCarousel上选择可见项目的数量

How to select the quantity of visible items on a responsive jCarousel

本文关键字:项目 选择 响应 jCarousel      更新时间:2023-09-26

如何选择jCarousel上可见项目的数量?我使用这个插件http://sorgalla.com/jcarousel/与这个模板http://sorgalla.com/jcarousel/examples/responsive/

无论我如何改变容器的宽度,默认最多显示3个元素,我希望至少显示5个元素。

这个设置可以在jcarousel.responsive.js文件中找到,这里是GitHub上的Responsive Carousel示例https://github.com/jsor/jcarousel/tree/master/examples/responsive。

if (width >= 600) {
  width = width / 3;
} else if (width >= 350) {
  width = width / 2;
}

确定将分别在大于600和350的屏幕上显示的项目数量,要在大屏幕上显示4个元素,在小屏幕(手机)上仅显示3个元素,您可以使用:

if (width >= 600) {
  width = width / 4;
} else if (width >= 350) {
  width = width / 3;
}

还要注意,有些用户似乎改变了设置"可见"(在jCarousel中设置可见图像的数量),这个变量似乎对响应式示例没有任何改变。