简体   繁体   English

bxslider,用于图像轮播,似乎对我不起作用?

[英]bxslider, for image carousel, doesn't seem to be working for me?

So I want to make a little image gallery carousel. 因此,我想制作一个小型图片库轮播。 Four images across. 横跨四个图像。 And you can carousel over to more images. 您还可以轮播更多图片。 I found bxslider and it seemed like a quick, plug & play, solution. 我找到了bxslider,这似乎是一种快速的即插即用解决方案。 But it's only showing one image per slide. 但是每张幻灯片只显示一张图像。

I think I've followed their directions. 我想我遵循了他们的指示。 But I've obviously done something wrong. 但是我显然做错了。

I've left their css and js untouched. 我让他们的CSS和JS保持不变。 My HTML looks like a copy of of theirs. 我的HTML看起来像是他们的副本。 And I put this at the end of their js file: 我将其放在他们的js文件的末尾:

$(document).ready(function(){
    $('.bxslider').bxSlider({
        mode: 'fade',
        captions: true,
        auto: true,
        autoControls: false,
        minSlides: 4
    });
});

Here's the jsfiddle: http://jsfiddle.net/7YH8Q/ 这是jsfiddle: http : //jsfiddle.net/7YH8Q/

Anyone know how I can get this to work? 有人知道我该如何使用它吗?

Multiple items per slides and fade mode is not currently supported. 当前不支持每张幻灯片有多个项目,并且不支持淡入淡出模式。 This has been flaged as an issue. 这已被标记为问题。 Changing mode is the only option to fix this with bxslider. 更改模式是使用bxslider修复此问题的唯一选项。

The problem is you didn't set slideWidth. 问题是您没有设置slideWidth。 In order to setup a carousal, you have to provide 3 values, namely : slideWidth, minSlides, maxSlides . 为了设置旋转木马,您必须提供3个值,即: slideWidth,minSlides,maxSlides

Here's a working fiddle http://jsfiddle.net/hwQ6C/ 这是一个有效的小提琴http://jsfiddle.net/hwQ6C/

$('.bxslider').bxSlider({
   slideWidth: 200,
   minSlides: 4,
   maxSlides: 5,
   slideMargin: 10
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM