简体   繁体   English

导航栏无法正常运行(Bootstrap v3)

[英]Navbar not working properly(bootstrap v3)

My nav bar is not behaving correctly. 我的导航栏行为不正确。 It displays the 3 slider images all in a vertical row at the same time and doesn't slide through the pictures. 它同时在垂直行中同时显示3个滑块图像,并且不会在图片中滑动。 The CSS used is that of twitter bootstrap. 使用的CSS是twitter bootstrap的CSS。 I have my own CSS in there but none that affect the carousel, also no added javascript, just the Jquery and the bootstrap.js. 我在那里有自己的CSS,但是没有影响轮播的CSS,也没有添加JavaScript,只有Jquery和bootstrap.js。 This is the bootstrap V3. 这是引导程序V3。 any idea? 任何想法?

<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>

Your issue seems to be that you have specified active class for all the slides. 您的问题似乎是您为所有幻灯片都指定了active班级。 Specify only for the first one to start with. 仅指定第一个开始。 Specifying active for all of them makes all of them visible and its selector which switches through the slides (not active item which is prev or next on click of buttons fails to pick up anything else) fails to select as there is nothing with non active is available anymore. 为所有这些对象都指定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 小提琴

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM