Ben O'Connor
Ben O'Connor

Reputation: 5

How can I change the default Twitter Bootstrap Carousel to always pause using javascript?

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

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:

$.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).

Upvotes: 0

Views: 2865

Answers (1)

albertedevigo
albertedevigo

Reputation: 18411

Pass interval: false as option:

$('.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)

Upvotes: 3

Related Questions