1

我有以下代码,并且已链接到 jQuery 等。但是,当我单击移动轮播时,它的作用与以下相同:

<a href="#"></a>

做。

谁能帮我修复我的代码!提前致谢!

<div id="carousel-example-generic" class="carousel slide">
  <!-- Indicators -->
  <ol class="carousel-indicators">
    <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
    <li data-target="#carousel-example-generic" data-slide-to="1"></li>
    <li data-target="#carousel-example-generic" data-slide-to="2"></li>
  </ol>

  <!-- Wrapper for slides -->
  <div class="carousel-inner">
    <div class="item active">
      <img src="img/slide1.jpg" alt="" width="100%" height="50%">
      <div class="carousel-caption">
        Test1
      </div>
    </div>
    <div class="item">
      <img src="img/slide1.jpg" alt="" width="100%" height="50%">
      <div class="carousel-caption">
        Test2
      </div>
    </div>
    ...
  </div>

  <!-- Controls -->
  <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
    <span class="icon-prev"></span>
  </a>
  <a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
    <span class="icon-next"></span>
  </a>
</div>

<div id="wrapper">





</div>


<script type="text/javascript">$('.carousel').carousel()</script>
<script type="text/javascript" src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
4

1 回答 1

2

初始化 jQuery 库后,您需要为轮播添加脚本标签。

<script type="text/javascript" src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script type="text/javascript">$('.carousel').carousel()</script>
于 2013-08-10T16:12:08.547 回答