将Bootstrap Carousel指示器更改为右侧和底部选项卡

时间:2015-03-29 08:27:46

标签: javascript css twitter-bootstrap

这是来自bootstrap网站的示例轮播模板 enter image description here 我想要做的是使上面图像中的黄色圆圈中的点成为正确的标签,如下图所示 enter image description here 当屏幕很窄时,标签移动到转盘的底部 enter image description here 怎么做?

编辑:

使用此代码:

<div id="myCarousel" class="carousel slide" data-ride="carousel">
  <div style="background-color: red;" class="slider col-lg-10">
    <div class="carousel-inner" role="listbox">
      <div class="item active">
        <img class="first-slide img-responsive center-block" src="assets/img/underconstruction.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><!-- carousel-caption -->
        </div><!-- container -->
      </div><!-- item active -->
      <div class="item">
        <img class="second-slide" src="assets/img/underconstruction.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><!-- carousel-caption -->
        </div><!-- container -->
      </div><!-- item -->
      <div class="item">
        <img class="third-slide" src="assets/img/underconstruction.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><!-- carousel-caption -->
        </div><!-- container -->
      </div><!-- item -->
    </div><!-- carousel-inner -->
  </div><!-- slider col-lg-10 -->

  <div data-target="#myCarousel" data-slide-to="0" style="background-color: blue;" class="tabs-vertical col-lg-2 visible-lg">TAB 1</div>
  <div data-target="#myCarousel" data-slide-to="1" style="background-color: yellow;" class="tabs-vertical col-lg-2 visible-lg">TAB 2</div>
  <div data-target="#myCarousel" data-slide-to="2" style="background-color: cyan;" class="tabs-vertical col-lg-2 visible-lg">TAB 3</div>

  <div data-target="#myCarousel" data-slide-to="0" style="background-color: blue;" class="tabs-horizontal col-xs-4 hidden-lg">TAB 1</div>
  <div data-target="#myCarousel" data-slide-to="1" style="background-color: yellow;" class="tabs-horizontal col-xs-4 hidden-lg">TAB 2</div>
  <div data-target="#myCarousel" data-slide-to="2" style="background-color: cyan;" class="tabs-horizontal col-xs-4 hidden-lg">TAB 3</div>
</div><!-- carousel slide -->

我设法在宽屏上显示: enter image description here

这在狭窄的屏幕上: enter image description here

感谢Justinas。

但垂直标签仍未填充其下方的其余空间。

1 个答案:

答案 0 :(得分:1)

使用Bootstrap网格系统。在宽屏幕上显示垂直标签,隐藏水平标签;在小 - 隐藏垂直标签,显示水平。

要隐藏某些元素,请使用hidden-[xs/sm/md/lg]visible-[xs/sm/md/lg]辅助类。

<div class="slider col-lg-10"></div>
<div class="tabs-vertical col-lg-2 visible-lg"></div>
<div class="tabs-horizontal col-xs-12 hidde-lg"></div>