当项目小于3时,Bootstrap轮播缩略图重复

时间:2018-01-29 07:46:43

标签: javascript jquery html css twitter-bootstrap

我正在使用bootstrap carousel缩略图。目前完成最后一个滑块后的滑块克隆。当我的滑块数小于3时,我需要停止重复项目。我已经尝试了下面的脚本。任何人都帮助我实现这一目标。

$ cat tp.c
#include <stdlib.h>
#include <stdio.h>
main(){
        float x;
        x=57.3/6;
        printf("Result:\n\t%.0f\n\t%.1f\n\t%.2f\n\t%.3f\n",x,x,x,x);
}

$ gcc tp.c -o tp
$ ./tp
Result:
        10
        9.6
        9.55
        9.550

在脚本下面我尝试了3个项目。如何用简化的脚本制作一个和两个项目。

<div id="carousel" class="carousel slide" data-ride="carousel" data-interval="false">
        <div class="carousel-inner">
            <div class="item active">
                <img src="images/homogeneous/marvel-stone/marvel-stone-detail.jpg" alt="">
            </div>
        </div>
    </div>
    <div class="clearfix">
        <div id="myCarousel" class="carousel slide" data-interval="false">
            <div class="carousel-inner">
                <div class="item active">                
                    <div class="thumb"><img src="images/homogeneous/marvel-stone/marvel-stone-thumb1.png" alt=""></div>
                </div>
                <div class="item">
                    <div class="thumb"><img src="images/homogeneous/marvel-stone/marvel-stone-thumb2.png" alt=""></div>
                </div>
                <div class="item">
                    <div class="thumb"><img src="images/homogeneous/marvel-stone/marvel-stone-thumb3.png" alt=""></div>
                </div>
                <div class="item">
                    <div class="thumb"><img src="images/homogeneous/marvel-stone/marvel-stone-thumb4.png" alt=""></div>
                </div>
            </div>
            <!-- /carousel-inner -->
            <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
           <span class="glyphicon glyphicon-chevron-left"></span>
        </a>
            <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
           <span class="glyphicon glyphicon-chevron-right"></span>
        </a>
        </div>
        <!-- /myCarousel -->
    </div>
<!-- /clearfix --> 

[my code link]

1 个答案:

答案 0 :(得分:0)

您可能会缺少一些CSS,请尝试使用以下代码进行实验: https://www.bootply.com/124854#