Bootstrap Carousel不显示所有缩略图

时间:2016-07-14 03:56:17

标签: html css asp.net twitter-bootstrap

我的bootstrap轮播无法显示所有缩略图。 我有4张图片,但它只显示了3张图片,最后一张是我网站上的空白图片。

这是我的代码:

<div id="myCarousel" class="carousel slide" data-ride="carousel">

  <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="Images/womenad1.jpg">
    </div>

    <div class="item">
      <img src="Images/womenad2.jpg">
    </div>

    <div class="item">
      <img src="Images/womenad3.jpg">
    </div>

    <div class="item">
      <img src="Images/womenad4.jpg">
    </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>

请告知。

2 个答案:

答案 0 :(得分:0)

我不确定出了什么问题,但我将所有缩略图的大小更改为几乎相同的宽度和高度。这解决了这个问题。

答案 1 :(得分:-2)

womenad4.jpg肯定是在Images目录中吗? 并检查它是否是png或其他文件类型。

这可能会起作用..

<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="Images/womenad1.jpg" alt="Chania">
    </div>

    <div class="item">
      <img src="Images/womenad2.jpg" alt="Chania">
    </div>

    <div class="item">
      <img src="Images/womenad3.jpg" alt="Flower">
    </div>

    <div class="item">
      <img src="Images/womenad4.jpg" alt="Flower">
    </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>