javascript - Bootstrap 轮播忽略数据间隔属性

标签 javascript jquery css twitter-bootstrap twitter-bootstrap-3

这是我的标记:

<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,但轮播在页面加载后仍然开始滚动。我也试过包括:

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

无论有没有 data-interval 属性,我都做过这件事,但都无济于事。页面加载后轮播自动开始滚动。我看到过其他关于此的问题,但它们都指的是旧版本,并暗示它现在已经修复。

有什么想法吗?

最佳答案

您的轮播标记适用于 3.0.3 ( http://bootply.com/103352 )

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

关于javascript - Bootstrap 轮播忽略数据间隔属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20873278/

相关文章:

javascript - 如何在轮播 slider 中选择此类的单个值并将其输出到事件幻灯片中?

javascript - 为什么我的按钮没有打印出代码并选择正确的选项?

jquery - Internet Explorer 9 给出 parseJSON 错误

php - 法语编码字符

html - 将文本突出显示限制在 <pre> block

CSS 下拉菜单在 IE 7 中不起作用

javascript - React Typescript 映射循环接口(interface)错误

javascript - 主干集合未完全从 JSON 填充

design-patterns - javascript模块模式中 undefined variable 的意义是什么

javascript - 如何在 vue+ts 中正确注册组件?