javascript - 导航栏无法正常工作(bootstrap v3)

标签 javascript jquery html css twitter-bootstrap

我的导航栏运行不正常。它同时在垂直行中显示 3 个 slider 图像,并且不会滑动图片。使用的 CSS 是 twitter bootstrap 的 CSS。我有自己的 CSS,但没有影响轮播,也没有添加 javascript,只有 Jquery 和 bootstrap.js。这是 Bootstrap V3。任何想法?

<div class="container">
   <div id="carousel-example-generic" class="carousel slide">
      <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>
      <div class="carousel-inner">
         <div class="item active">
            <img src="img/timthumb.jpg" alt="...">
            <div class="carousel-caption">
               <p>Eyes of the owl</p>
            </div>
         </div>
         <div class="item active">
            <img src="img/timthumb.jpg" alt="...">
            <div class="carousel-caption">
               <p>Eyes of the owl</p>
            </div>
         </div>
         <div class="item active">
            <img src="img/timthumb.jpg" alt="...">
            <div class="carousel-caption">
               <p>Eyes of the owl</p>
            </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>

最佳答案

您的问题似乎是您为所有幻灯片指定了 active 类。 仅指定第一个开始的。为所有这些指定 active 使它们全部可见,并且它的选择器在幻灯片中切换(不是上一个事件元素)或下一步点击按钮无法拾取任何其他东西)无法选择,因为没有任何非事件的可用了。

            <div class="item active">
                <img src="http:\\placehold.it\32x100" alt="..." />
                <div class="carousel-caption">
                    <p>Eyes of the owl</p>
                </div>
            </div>
            <div class="item"> <!-- removed active class from here -->
                <img src="http:\\placehold.it\42x100" alt="..." />
                <div class="carousel-caption">
                    <p>Eyes of the owl</p>
                </div>
            </div>
            <div class="item"><!-- removed active class from here -->
                <img src="http:\\placehold.it\52x100" alt="..." />
                <div class="carousel-caption">
                    <p>Eyes of the owl</p>
                </div>
            </div>

Fiddle

关于javascript - 导航栏无法正常工作(bootstrap v3),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18907860/

相关文章:

javascript - Node Schedule是否产生/ fork 新进程

javascript - RESTful GET 资源应如何接受日期时间参数?

jquery - jQuery 1.4 语法与 1.3 及更早版本相同吗?

html - 使用具有当前状态的图像和 CSS 的导航栏

javascript - 在不重新加载的情况下更改 HTML 页面上的特定元素

javascript - 字符串格式 | JavaScript | iMacros

javascript - jsTree 3.3.2 - 如何配置 jsTree 以便只有一些节点是可拖动的并且可以在特定级别删除

javascript - 使用 Jquery 的 Twitter 登录 Oauth 问题

javascript - To do list in Javascript - 如何始终将新元素插入列表顶部?

html - 在单个 bootstrap 行中使用两列,如何将文本垂直居中?