引导轮播暂停不起作用 [英] bootstrap carousel pause not working

查看:66
本文介绍了引导轮播暂停不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在Bootstrap(3.0.2)传送带上调用暂停功能。我已经尽力尝试引用轮播实例,但是-没有错误,也没有暂停。

I'm unable to invoke the 'pause' function on the Bootstrap (3.0.2) carousel. I've tried every way I can think of to refer to the carousel instance, but - no errors, no pause.

<script>
    var stepIndex = 3;
    $('.carousel').carousel({
        interval: 3000
    });
    $('#carousel-couples').on('slide.bs.carousel', function () {
        stepIndex--
        console.log("carousel stepping", stepIndex);
        if (stepIndex == 0) {
            console.log("supposedly pausing carousel");
            $('.carousel').carousel('pause');
        }
    })
</script>
</body>
</html>


推荐答案

调用轮播时暂停,但滑动似乎没有去工作。而是在幻灯片完成转换后使用 slid.bs.carousel 事件运行,然后您的暂停应该可以工作。

Calling pause on a carousel while its sliding does not seem to work. Instead use the slid.bs.carousel event runs once the slide has finished the transition and then your pause should work.

$('#carousel-couples').on('slid.bs.carousel', function () {
    ...
});

这篇关于引导轮播暂停不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆