Bootstrap传送带间隔错误不起作用 [英] Bootstrap Carousel Interval False Not working

查看:87
本文介绍了Bootstrap传送带间隔错误不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网站上安装了Twitter Bootstrap-Carousel,我希望能够使用它来浏览模块的窗格,但是,将间隔设置为false不起作用。如果我给它一个时间间隔,它会像预定的一样顺利完成,但作为false我无法使用控件来浏览幻灯片。我通过ID而不是$('。carousel')来选择容器,所以我不知道这与它有什么关系。是否需要另一个模块来提供间隔假功能?



我的html的一个简单示例是:

 < div class =carouselid =module-rotator> 
< div class =carousel-inner>
< div class =item active> foo< / div>
< div class =item>栏< / div>
< / div>
< a class =carousel-control lefthref =#module-rotatordata-slide =prev>& lsaquo;< / a>
< a class =carousel-control righthref =#module-rotatordata-slide =next>& rsaquo;< / a>
< / div>

我用这个初始化传送带:

  $('#module-rotator')。carousel({interval:false}); 

我正在使用bootstrap-carousel.js v2.0.3

解决方案

我使用类似的代码来处理你的事情,一切都按预期工作。唯一的区别是;


  • 我使用的是完整的bootstrap.js(v2.0.3)(所以不是单独的引导程序js文件)

  • 我也在carousel类旁边有幻灯片类 - 没有这个div,它仍然会改变,只是不会滑动。



使用自举失败阅读的答案类似的问题后-carousel.js 我会怀疑你还需要引导,carousel.js之前,包括自举transition.js



我建议使用完整bootstrap.js文件只是为了验证它的工作原理,然后再玩个别的js文件。


I've installed Twitter Bootstrap-Carousel on a site and I wanted to be able to use it to step through panes of a module, however, setting interval to false is not working. If I give it an interval, it will step through just fine as scheduled, but as false I am unable to use the controls to step through the slides. I am selecting the container by ID rather than $('.carousel') so I don't know if that has anything to do with it. Is there another module needed that gives the interval false functionality?

A brief example of my html is:

    <div class="carousel" id="module-rotator">
        <div class="carousel-inner">
            <div class="item active">foo</div>
            <div class="item">bar</div>
        </div>
        <a class="carousel-control left" href="#module-rotator" data-slide="prev">&lsaquo;</a>
        <a class="carousel-control right" href="#module-rotator" data-slide="next">&rsaquo;</a>
    </div>

and I initialize the carousel with this:

$('#module-rotator').carousel({ interval: false });

I am using bootstrap-carousel.js v2.0.3

解决方案

I am using similar code to yours and everything works as expected. The only differences are;

  • I'm using the complete bootstrap.js (v2.0.3) (so not individual bootstrap js files)
  • I also have the "slide" class next to the "carousel" class - without this the divs would still change, just not slide.

After reading the answer to a similar question failed using bootstrap-carousel.js I would suspect you'll also need to include bootstrap-transition.js before the bootstrap-carousel.js

I suggest using the complete bootstrap.js file just to verify it works, then play around with the individual js files.

这篇关于Bootstrap传送带间隔错误不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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