如何更改默认的Twitter Bootstrap Carousel以始终使用javascript暂停?

时间:2022-11-03 21:36:23

I'm building a Rails app and have copied the files from the Bootstrap Github download to my asset pipeline and everything works fine.

我正在构建一个Rails应用程序并将文件从Bootstrap Github下载复制到我的资产管道,一切正常。

I'm now looking to switch off the carousel default slide action, because I'm embedding audio, and want the visitor to manually toggle.

我现在想要关闭轮播默认幻灯片操作,因为我正在嵌入音频,并希望访问者手动切换。

I've found the defaults in bootstrap.js:

我在bootstrap.js中找到了默认值:

$.fn.carousel.defaults = {
interval: 5000
, pause: 'hover'
}

what is the entry to here make it always pause ?

这里的条目是什么让它总是暂停?

pause, mouseenter and mouseleave all failed (I really thought mouseleave would work - click, move off pause, but no).

暂停,mouseenter和mouseleave都失败了(我真的认为mouseleave可以工作 - 点击,暂停,但没有)。

1 个解决方案

#1


3  

Pass interval: false as option:

传递间隔:false作为选项:

$('.carousel').carousel({
    interval: false
})

interval: The amount of time to delay between automatically cycling an item. If false, carousel will not automatically cycle. (from documentation)

interval:自动循环项目之间的延迟时间。如果为false,轮播将不会自动循环。 (来自文件)

#1


3  

Pass interval: false as option:

传递间隔:false作为选项:

$('.carousel').carousel({
    interval: false
})

interval: The amount of time to delay between automatically cycling an item. If false, carousel will not automatically cycle. (from documentation)

interval:自动循环项目之间的延迟时间。如果为false,轮播将不会自动循环。 (来自文件)