Bootstrap 3.2旋转木马隐藏在导航栏后面

时间:2014-10-27 17:38:02

标签: jquery css twitter-bootstrap-3

我正在使用Bootstrap 3.2制作导航栏和旋转木马,但当我将浏览器宽度减少到移动设备时,旋转木马会隐藏在导航栏下。

在回复this similar question时,我尝试了提供的解决方案,但随后轮播没有更多响应。

我在Bootstrap的网站上关注了这个例子,但their components page上没有关于轮播的例子。所以我从他们主页上的模板中看到了旋转木马的代码。难道不是为什么它隐藏了?我使用的是不正确的班级吗?

这是jsfiddle

我的旋转木马代码:

<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>
              </ol>
              <div class="carousel-inner">
                <div class="item active">
                  <img src="images/carousel_large_01.jpg" alt="First slide">
                  <div class="container">
                    <div class="carousel-caption">
                      <h1>Example headline.</h1>
                      <p>Note: If you're viewing this page via a <code>file://</code> URL, the "next" and "previous" Glyphicon buttons on the left and right might not load/display properly due to web browser security rules.</p>
                      <p><a class="btn btn-lg btn-primary" href="#" role="button">Sign up today</a></p>
                    </div>
                  </div>
                </div>
                <div class="item">
                  <img src="images/carousel_large_02.jpg" alt="Second slide">
                  <div class="container">
                    <div class="carousel-caption">
                      <h1>Another example headline.</h1>
                      <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
                      <p><a class="btn btn-lg btn-primary" href="#" role="button">Learn more</a></p>
                    </div>
                  </div>
                </div>
                <div class="item">
                  <img src="images/carousel_large_03.jpg" alt="Third slide">
                  <div class="container">
                    <div class="carousel-caption">
                      <h1>One more for good measure.</h1>
                      <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
                      <p><a class="btn btn-lg btn-primary" href="#" role="button">Browse gallery</a></p>
                    </div>
                  </div>
                </div>
              </div>
              <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>
              <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a>
        </div>

1 个答案:

答案 0 :(得分:0)

如果你删除了navbar-fixed-top课程,那么轮播就像你想要的那样。如果你想使用navbar-fixed-top类,并且希望轮播将显示在导航栏下方,可以添加一些自定义css,如.someclass{margin-top:20px;}或添加一些引导类,如jumbotron等。

添加navbar-fixed-top会将导航栏固定/固定在顶部,这就是旋转木马会隐藏在其后面的原因。

您还可以查看This的响应式课程