Bootstrap 3默认轮播:如何将指示器向下移动到幻灯片容器外?

时间:2013-11-26 02:35:43

标签: twitter-bootstrap twitter-bootstrap-3 carousel

将Bootstrap 3的旋转木马指示器向下移动到幻灯片容器外部是一种简单(干净)的方式,这样它就不会叠加在照片上?请参阅下面的图片,了解我想要移动指示器的位置。

Link to live code

enter image description here

<div class="container">
    <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/1170x300.jpg" alt="...">
            </div>

            <div class="item">
                <img src="http://placehold.it/1170x300.jpg" alt="...">
            </div>

            <div class="item">
                <img src="http://placehold.it/1170x300.jpg" alt="...">
            </div>

        </div>

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

</div><!--//container -->

5 个答案:

答案 0 :(得分:75)

你可以将它们推到滑块下方......

.carousel-indicators {
  bottom:-50px;
}

在旋转木马下方留出空间,以便推动的指示器不会干扰滑块下方的内容。

.carousel-inner {
   margin-bottom:50px;
}

Bootply Demo

答案 1 :(得分:2)

你可以简单地在指标类之后添加隐藏的bootstrap类,如下所示:

<ol class="carousel-indicators hidden">
<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>

答案 2 :(得分:0)

自定义您的商品类div

 <div class="item">
     <div class="col-mid-1"> &nbsp; </div>
         <div class="col-md-10"> your content </div> 
             <!-- Note total should not be greater than 12 that is 1 + 10 + 1 = 12--> 
             <div class="col-mid-1"> &nbsp; </div>
 </div>

当我不想要内容div上的图标时,这对我有用

答案 3 :(得分:-4)

您可以将边框设置为0px,如下所示:

.carousel-indicators li{
  border: 0px;
}

答案 4 :(得分:-13)

你可以写:

.carousel-indicators {
  display:none;
}