如何在bootstrap轮播中显示指标

时间:2015-05-29 20:54:04

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

轮播应包含显示当前幻灯片的指示器,并允许通过单击指示器来选择幻灯片。 幻灯片应在5秒后改变。 根据Bootstrasp 3轮播文档,它应该支持这一点。 实际上,指标没有显示出来。

我尝试使用bootstrap手册中的代码:

    <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" class=""></li>
            <li data-target="#carousel-example-generic" data-slide-to="2"></li>
            <li data-target="#carousel-example-generic" data-slide-to="3"></li>
            <li data-target="#carousel-example-generic" data-slide-to="4"></li>
            <li data-target="#carousel-example-generic" data-slide-to="5"></li>
            <li data-target="#carousel-example-generic" data-slide-to="6"></li>
            <li data-target="#carousel-example-generic" data-slide-to="7"></li>
            <li data-target="#carousel-example-generic" data-slide-to="8"></li>
        </ol>
    <!-- Wrapper for slides -->
    <div class="carousel-inner" role="listbox">
            <div class="item active">

                <a href="/store/Webconte/Details/124">
                    <img src="/store/Webconte/Image/124" />
                </a>
            </div>
            <div class="item ">

                <a href="/store/Webconte/Details/123">
                    <img src="/store/Webconte/Image/123" />
                </a>
            </div>
            <div class="item ">

                <a href="/store/Webconte/Details/105">
                    <img src="/store/Webconte/Image/105" />
                </a>
            </div>
            <div class="item ">

                <a href="/store/Webconte/Details/95">
                    <img src="/store/Webconte/Image/95" />
                </a>
            </div>
            <div class="item ">

                <a href="/store/Webconte/Details/107">
                    <img src="/store/Webconte/Image/107" />
                </a>
            </div>
            <div class="item ">

                <a href="/store/Webconte/Details/100">
                    <img src="/store/Webconte/Image/100" />
                </a>
            </div>
            <div class="item ">

                <a href="/store/Webconte/Details/98">
                    <img src="/store/Webconte/Image/98" />
                </a>
            </div>
            <div class="item ">

                <a href="/store/Webconte/Details/78">
                    <img src="/store/Webconte/Image/78" />
                </a>
            </div>
            <div class="item ">

                <a href="/store/Webconte/Details/11">
                    <img src="/store/Webconte/Image/11" />
                </a>
            </div>

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

但不显示指标。 如何解决这个问题?

2 个答案:

答案 0 :(得分:0)

.carousel-indicators放入.carousel-inner

UPD:好的..试试这个:

<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
    <div class="item active">

        <a href="/store/Webconte/Details/124">
            <img src="/store/Webconte/Image/124" />
        </a>
    </div>
    <div class="item ">

        <a href="/store/Webconte/Details/123">
            <img src="/store/Webconte/Image/123" />
        </a>
    </div>
    <div class="item ">

        <a href="/store/Webconte/Details/105">
            <img src="/store/Webconte/Image/105" />
        </a>
    </div>
    <div class="item ">

        <a href="/store/Webconte/Details/95">
            <img src="/store/Webconte/Image/95" />
        </a>
    </div>
    <div class="item ">

        <a href="/store/Webconte/Details/107">
            <img src="/store/Webconte/Image/107" />
        </a>
    </div>
    <div class="item ">

        <a href="/store/Webconte/Details/100">
            <img src="/store/Webconte/Image/100" />
        </a>
    </div>
    <div class="item ">

        <a href="/store/Webconte/Details/98">
            <img src="/store/Webconte/Image/98" />
        </a>
    </div>
    <div class="item ">

        <a href="/store/Webconte/Details/78">
            <img src="/store/Webconte/Image/78" />
        </a>
    </div>
    <div class="item ">

        <a href="/store/Webconte/Details/11">
            <img src="/store/Webconte/Image/11" />
        </a>
    </div>

    <!-- Controls -->
    <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
        <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
    </a>
    <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
        <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
    </a>
    <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" class=""></li>
        <li data-target="#carousel-example-generic" data-slide-to="2"></li>
        <li data-target="#carousel-example-generic" data-slide-to="3"></li>
        <li data-target="#carousel-example-generic" data-slide-to="4"></li>
        <li data-target="#carousel-example-generic" data-slide-to="5"></li>
        <li data-target="#carousel-example-generic" data-slide-to="6"></li>
        <li data-target="#carousel-example-generic" data-slide-to="7"></li>
        <li data-target="#carousel-example-generic" data-slide-to="8"></li>
    </ol>
</div>

答案 1 :(得分:0)

实际上指标正在显示。设置:

.carousel-indicators li {
    background-color: black;
}

你可以在页面底部看到它们。

修改

试试这个,并在页面底部查找它们:

.carousel-indicators {
    background-color: black;
}