Reputation: 13
--UPDATE-- I found the solution, pause didn't work for me, but I found out that if you add: interval: false it works just like I wanted to. thank you guys :)
I'm using Bootstrap's 3 carousel, I've been trying to stop it so that it doesn't auto slide. I've been using the function provided by them. This is what I have:
$('.carousel').carousel({
.carousel('pause')
})
How can I stop it?
This is the HTML, default from Bootstrap's sample page:
<!-- Carousel
================================================== -->
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="item active">
<iframe width="100%" height="630" src="//www.youtube.com/embed/9vTguAVhjBo" frameborder="0" allowfullscreen></iframe>
<div class="container">
<div class="carousel-caption">
<h1>Example headline.</h1>
<p>Note: If you're viewing this page via a <code>file://</code> URL, the "next" and "previous" Glyphicon buttons on the left and right might not load/display properly due to web browser security rules.</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Sign up today</a></p>
</div>
</div>
</div>
<div class="item">
<iframe width="100%" height="630" src="//www.youtube.com/embed/gyV2CSqJi1I" frameborder="0" allowfullscreen></iframe>
<div class="container">
<div class="carousel-caption">
<h1>Another example headline.</h1>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Learn more</a></p>
</div>
</div>
</div>
<div class="item">
<iframe width="100%" height="630" src="//www.youtube.com/embed/kYbvYS65iDs" frameborder="0" allowfullscreen></iframe>
<div class="container">
<div class="carousel-caption">
<h1>One more for good measure.</h1>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Browse gallery</a></p>
</div>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>
<a class="right carousel-control" href="#myCarousel" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a>
</div><!-- /.carousel -->
Upvotes: 1
Views: 2908
Reputation: 1
pass attr data-interval
replace
<div id="myCarousel" class="carousel slide" data-ride="carousel">
to
<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="false">
diff : data-interval="false"
Upvotes: 0
Reputation: 17324
interval:The amount of time to delay between automatically cycling an item. If false, carousel will not automatically cycle.
$('.carousel').carousel({
interval: false
})
Upvotes: 2
Reputation: 428
Instead, use this line
$('.carousel').carousel('pause');
Upvotes: 1