本文介绍了Bootstrap轮播忽略数据区间属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的标记:

<div id="carousel-example-generic" class="carousel slide" data-interval="false" data-pause="hover">
        <!-- Indicators -->
        <ol class="carousel-indicators">
            <li data-target="#carousel-example-generic" data-slide-to="0"></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">
                <div style="height:200px;">Slide 1</div>
                <div class="carousel-caption">
                    ...
                </div>
            </div>
            <div class="item">
                <div style="height:200px;">Slide 2</div>
                <div class="carousel-caption">
                    ...
                </div>
            </div>
            <div class="item ">
                <div style="height:200px;">Slide 3</div>
                <div class="carousel-caption">
                    ...
                </div>
            </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>

我正在使用bootstrap v3.0.3,但是在加载页面后轮播仍然开始滚动。我也试过包括:

I am using bootstrap v3.0.3, and yet the carousel still starts scrolling after page is loaded. I have also tried including:

$(function () {
    $(".carousel").carousel({ interval: false });
});

我使用和不使用数据间隔属性,一切都无济于事。加载页面后,轮播会自动开始滚动。我已经看到了有关此问题的其他问题,但它们都是指旧版本,暗示它现在已修复。

I've done this with and without the data-interval attribute, all to no avail. The carousel automatically starts scrolling after page is loaded. I have seen other questions about this but they were all referring to older version and implied it has been fixed by now.

有任何想法吗?

推荐答案

您的轮播标记对于3.0.3是正确的()

Your carousel markup is correct for 3.0.3 (http://bootply.com/103352)

确保同一页面上没有其他JavaScript代码或其他轮播。

Make sure there is not other JavaScript code or other carousels on the same page.

这篇关于Bootstrap轮播忽略数据区间属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 19:13