您好我使用bootstrap Carousel来显示图像。我想每张幻灯片只显示四张图片。但是在这里,由于这些图像是通过循环动态传递的,我无法将图像移动到下一张幻灯片。我尝试了slice()和wrapAll()方法,但我没有得到所需的结果&我不知道这种方法是对还是错。请帮我解决这个问题。提前致谢。 注意:请全屏查看小提琴。
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdn.paperindex.com/css/paperindex-home.css">
<script src="https://cdn.paperindex.com/js/paperindex-home.min.js">
</script>
<div class="our-partners-wrap hidden-xs">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<h2 class="text-center section-heading">Our Partners</h2>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div id="Carousel" class="carousel slide">
<!-- Carousel items -->
<div class="carousel-inner">
<div class="item active">
<div class="row justify">
<div class="col-xs-12 col-sm-6 col-md-3">
<a href="http://expogr.com/ethiopia/pppexpo/index.php" class="thumbnail"><img src="https://cdn.paperindex.com/banner/300x250.jpg" alt="Image" style="max-width:100%;"></a>
</div>
<div class="col-xs-12 col-sm-6 col-md-3">
<a href="http://www.tissueworld.com/miami" class="thumbnail"><img src="https://cdn.paperindex.com/banner/Tissue_World_Miami-300x250.png" alt="Image" style="max-width:100%;"></a>
</div>
<div class="col-xs-12 col-sm-6 col-md-3">
<a href="http://www.expogr.com/kenyappp/index.php" class="thumbnail"><img src="https://cdn.paperindex.com/banner/300x250 kenya.jpg" alt="Image" style="max-width:100%;"></a>
</div>
<div class="col-xs-12 col-sm-6 col-md-3">
<a href="http://www.expogr.com/tanzania/pppexpo/index.php" class="thumbnail"><img src="https://cdn.paperindex.com/banner/300x250 tanzania.jpg" alt="Image" style="max-width:100%;"></a>
</div>
<div class="col-xs-12 col-sm-6 col-md-3">
<a href="http://www.expogr.com/tanzania/pppexpo/index.php" class="thumbnail"><img src="https://cdn.paperindex.com/banner/300x250 tanzania.jpg" alt="Image" style="max-width:100%;"></a>
</div>
<div class="col-xs-12 col-sm-6 col-md-3">
<a href="http://www.expogr.com/tanzania/pppexpo/index.php" class="thumbnail"><img src="https://cdn.paperindex.com/banner/300x250 tanzania.jpg" alt="Image" style="max-width:100%;"></a>
</div>
<div class="col-xs-12 col-sm-6 col-md-3">
<a href="http://www.expogr.com/tanzania/pppexpo/index.php" class="thumbnail"><img src="https://cdn.paperindex.com/banner/300x250 tanzania.jpg" alt="Image" style="max-width:100%;"></a>
</div>
<div class="col-xs-12 col-sm-6 col-md-3">
<a href="http://www.expogr.com/tanzania/pppexpo/index.php" class="thumbnail"><img src="https://cdn.paperindex.com/banner/300x250 tanzania.jpg" alt="Image" style="max-width:100%;"></a>
</div>
<div class="col-xs-12 col-sm-6 col-md-3">
<a href="http://www.expogr.com/tanzania/pppexpo/index.php " class="thumbnail"><img src="https://cdn.paperindex.com/banner/300x250 tanzania.jpg" alt="Image" style="max-width:100%;"></a>
</div>
<div class="col-xs-12 col-sm-6 col-md-3">
<a href="	 http://www.expogr.com/kenyappp/index.php" class="thumbnail"><img src="https://cdn.paperindex.com/banner/	 300x250 kenya.jpg" alt="Image" style="max-width:100%;"></a>
</div>
</div>
<!-- row-1 -->
</div>
<!--.item-->
</div>
<!--.carousel-inner-->
<div class="pi-carousel-controls hidden-xs visible-md-up">
<a data-slide="prev" href="#Carousel" class="left carousel-control"><i class="fa fa-angle-left"></i></a>
<a data-slide="next" href="#Carousel" class="right carousel-control"><i class="fa fa-angle-right"></i></a>
</div>
</div>
<!--.Carousel-->
</div>
</div>
</div>
<!--.container-fluid-->
</div>
&#13;
答案 0 :(得分:0)
您可以尝试使用此代码段
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdn.paperindex.com/css/paperindex-home.css">
<script src="https://cdn.paperindex.com/js/paperindex-home.min.js">
</script>
<div class="col-md-12 text-center">
<h3>Partners</h3>
</div>
<div class="col-md-6 col-md-offset-3">
<div class="carousel slide" id="myCarousel">
<div class="carousel-inner">
<div class="item active">
<div class="row">
<div class="col-xs-3">
<a href="#"><img src="http://placehold.it/500/e499e4/fff&text=1" class="img-responsive"></a>
</div>
<div class="col-xs-3">
<a href="#"><img src="http://placehold.it/500/e499e4/fff&text=2" class="img-responsive"></a>
</div>
<div class="col-xs-3">
<a href="#"><img src="http://placehold.it/500/e499e4/fff&text=3" class="img-responsive"></a>
</div>
<div class="col-xs-3">
<a href="#"><img src="http://placehold.it/500/e499e4/fff&text=4" class="img-responsive"></a>
</div>
</div>
</div>
<div class="item">
<div class="row">
<div class="col-xs-3">
<a href="#"><img src="http://placehold.it/500/e499e4/fff&text=5" class="img-responsive"></a>
</div>
<div class="col-xs-3">
<a href="#"><img src="http://placehold.it/500/e499e4/fff&text=6" class="img-responsive"></a>
</div>
<div class="col-xs-3">
<a href="#"><img src="http://placehold.it/500/e499e4/fff&text=7" class="img-responsive"></a>
</div>
<div class="col-xs-3">
<a href="#"><img src="http://placehold.it/500/e499e4/fff&text=8" class="img-responsive"></a>
</div>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev"><i class="glyphicon glyphicon-chevron-left"></i></a>
<a class="right carousel-control" href="#myCarousel" data-slide="next"><i class="glyphicon glyphicon-chevron-right"></i></a>
</div>
</div>