javascript - Bootstrap carousel stop cycling when some event occur -
javascript - Bootstrap carousel stop cycling when some event occur -
using bootstrap carousel had problem stopping auto cycle.
it said in documentation, if set interval:false, carousel won't auto cycle, there nil said do, when need stop auto cycle when event occurs.
lets have code @ project
$('#carousel-images').carousel({ interval: 5000, pause : 'hover' });
then have click event handler, should 2 things
first: n-th slide should set
second: auto-slide should stop
$('.smallslide').click(function(e) { $('#carousel-images').carousel(4); $('#carousel-images').carousel('pause'); }
this code won't trick, because 'pause' tried set @ moment of slide beingness slided.
this work you:
$('.smallslide').click(function(e) { $('#carousel-images').carousel(4); $('#carousel-images').on('slid.bs.carousel', function () { $('#carousel-images').carousel('pause'); }); }
javascript jquery twitter-bootstrap carousel
Comments
Post a Comment