javascript - Bootstrap 3 Carousel 在本地工作但不会在服务器上滑动

标签 javascript jquery html twitter-bootstrap

我有这个 html

   <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
  <!-- 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="http://placehold.it/1200x315" alt="...">
      <div class="carousel-caption">
          <h3>Caption Text</h3>
      </div>
    </div>
    <div class="item">
      <img src="http://placehold.it/1200x315" alt="...">
      <div class="carousel-caption">
          <h3>Caption Text</h3>
      </div>
    </div>
    <div class="item">
      <img src="http://placehold.it/1200x315" alt="...">
      <div class="carousel-caption">
          <h3>Caption Text</h3>
      </div>
    </div>
  </div>

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

我已将托管 jquery 和本地 bootstrap.js 添加到 html 文件的头部,如下所示

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>

轮播不起作用后,我将 jquery 引用移动到 html 页面的底部,看看它是否会加载,因为 html 从上到下加载,但仍然没有运气。关于如何让它工作有什么想法吗?我是 JQuery 新手,所以请描述一下。

最佳答案

试试这个:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

关于javascript - Bootstrap 3 Carousel 在本地工作但不会在服务器上滑动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33538861/

相关文章:

javascript - 为什么将 `this` 分配给 `self` 并运行 `self.method()` ?

jquery - 重复多个图像作为不同样式的背景

JQuery自动完成Ajax验证特殊字符

jQuery 元素 ID 更改导致错误

java - 小程序的烦恼

javascript - 轻量级的Web和移动“所见即所得”文本编辑器?

android 如何在 android Webview 中获取点击字符串?

javascript - Mootools/Prime 中的类、选项

javascript - 进度条在文件上传中未更新其宽度

javascript - 测试 JavaScript 的最佳方法是什么?