2016-11-23 57 views

回答

0

这里是一个link到W3学校引导。他们有一个carusel供您使用!

*注意W3学校©要求您有权使用他们的材料,除非您没有赚钱和/或没有获得所有权。

+0

谢谢,但旋转木马显示一张图片。我想显示多个图像,并且每次点击一个按钮(下一个或上一个)时,图像都会右移(或左移)。我想创建这个图像列表中的一个UL(或OL),但我不知道如何改变它们? – hunter

0

你用这个吗?

<!DOCTYPE html> 
 
<html lang="en"> 
 

 
<head> 
 
    <title>Bootstrap Example</title> 
 
    <meta charset="utf-8"> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> 
 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> 
 
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 
 
    <style> 
 
    .carousel-inner > .item > img, 
 
    .carousel-inner > .item > a > img { 
 
     width: 70%; 
 
     margin: auto; 
 
    } 
 
    </style> 
 
</head> 
 

 
<body> 
 

 
    <div class="container"> 
 
    <br> 
 
    <div id="myCarousel" class="carousel slide" data-ride="carousel"> 
 
     <!-- Indicators --> 
 
     <ol class="carousel-indicators"> 
 
     <li data-target="#myCarousel" data-slide-to="0" class="active"></li> 
 
     <li data-target="#myCarousel" data-slide-to="1"></li> 
 
     <li data-target="#myCarousel" data-slide-to="2"></li> 
 
     <li data-target="#myCarousel" data-slide-to="3"></li> 
 
     </ol> 
 

 
     <!-- Wrapper for slides --> 
 
     <div class="carousel-inner" role="listbox"> 
 
     <div class="item active"> 
 
      <img src="http://www.w3schools.com/bootstrap/img_chania.jpg" alt="Chania" width="460" height="345"> 
 
     </div> 
 

 
     <div class="item"> 
 
      <img src="http://www.w3schools.com/bootstrap/img_chania2.jpg" alt="Chania" width="460" height="345"> 
 
     </div> 
 

 
     <div class="item"> 
 
      <img src="http://www.w3schools.com/bootstrap/img_flower.jpg" alt="Flower" width="460" height="345"> 
 
     </div> 
 

 
     <div class="item"> 
 
      <img src="http://www.w3schools.com/bootstrap/img_flower2.jpg" alt="Flower" width="460" height="345"> 
 
     </div> 
 
     </div> 
 

 
     <!-- Left and right controls --> 
 
     <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev"> 
 
     <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> 
 
     <span class="sr-only">Previous</span> 
 
     </a> 
 
     <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next"> 
 
     <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> 
 
     <span class="sr-only">Next</span> 
 
     </a> 
 
    </div> 
 
    </div> 
 

 
</body> 
 

 
</html>

+0

是的,我熟悉bootstrap旋转木马,但在这种情况下,我希望旋转木马在一次拍摄中显示多个(例如四个)图像,并且每次我点击下一个按钮,一个图像添加到右侧(左移) 有这个目的的好方法吗? – hunter

相关问题