Toggle navigation
Bootsnipp
Bootstrap
For
CSS Frameworks
Bootstrap
Foundation
Semantic UI
Materialize
Pure
Bulma
References
CSS Reference
Tools
Community
Page Builder
Form Builder
Button Builder
Icon Search
Dan's Tools
Diff / Merge
Color Picker
Keyword Tool
Web Fonts
.htaccess Generator
Favicon Generator
Site Speed Test
Snippets
Featured
Tags
By Bootstrap Version
4.1.1
4.0.0
3.3.0
3.2.0
3.1.0
3.0.3
3.0.1
3.0.0
2.3.2
Register
Login
"Bootstrap 3.0 Carousel with Pause and Play1"
Bootstrap 3.3.0 Snippet by
slshailesh
3.3.0
jQuery
carousel
Preview
HTML
CSS
JS
View Full Screen
Fork
Fork this
4.7K
 
0 Fav
Post to Facebook
Tweet this
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <!-- Carousel --> <div id="homeCarousel" class="carousel slide"> <!-- Menu --> <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> <!-- Items --> <div class="carousel-inner"> <!-- Item 1 --> <div class="item active"> <img src="http://lorempixel.com/1500/600/abstract/1"/> <div class="container"> <div class="carousel-caption"> <h1>Bootstrap 3 Carousel Layout</h1> <p>This is an example layout with carousel that uses the Bootstrap 3 styles.</p> <p><a class="btn btn-lg btn-primary" href="http://getbootstrap.com">Learn More</a> </p></div> </div> </div> <!-- Item 2 --> <div class="item"> <img src="http://lorempixel.com/1500/600/abstract/2"/> <div class="container"> <div class="carousel-caption"> <h1>Changes to the Grid</h1> <p>Bootstrap 3 still features a 12-column grid, but many of the CSS class names have completely changed.</p> <p><a class="btn btn-large btn-primary" href="#">Learn more</a></p> </div> </div> </div> <!-- Item 3 --> <div class="item"> <img src="http://lorempixel.com/1500/600/abstract/3" /> <div class="container"> <div class="carousel-caption"> <h1>Percentage-based sizing</h1> <p>With "mobile-first" there is now only one percentage-based grid.</p> <p><a class="btn btn-large btn-primary" href="#">Browse gallery</a></p> </div> </div> </div> </div> <!-- Controls --> <a class="left carousel-control" href="#myCarousel" data-slide="prev"> <span class="icon-prev"></span> </a> <a class="right carousel-control" href="#myCarousel" data-slide="next"> <span class="icon-next"></span> </a> <div id="carouselButtons"> <button id="playButton" type="button" class="btn btn-default btn-xs"> <span class="glyphicon glyphicon-play"></span> </button> <button id="pauseButton" type="button" class="btn btn-default btn-xs"> <span class="glyphicon glyphicon-pause"></span> </button> </div> </div> <!-- Post Info --> <div style='position:fixed;bottom:0;left:0; background:lightgray;width:100%;'> About this SO Question: <a href='http://stackoverflow.com/q/20615100/1366033'>Add Play/Pause button to bootstrap carousel</a><br/> Find documentation: <a href='http://getbootstrap.com/css/'>Get Bootstrap 3.0</a><br/> Fork This Skeleton Here <a href='http://jsfiddle.net/KyleMit/kcpma/'>Bootrsap 3.0 Skeleton</a><br/> <div>
#carouselButtons { margin-left: 100px; position: absolute; bottom: 0px; }
$(function () { $('#homeCarousel').carousel({ interval:2000, pause: "false" }); $('#playButton').click(function () { $('#homeCarousel').carousel('cycle'); }); $('#pauseButton').click(function () { $('#homeCarousel').carousel('pause'); }); });
Questions / Comments:
Post
Posting Guidelines
Formatting
- Now
×
Close
Donate
BTC: 12JxYMYi6Vt3mx3hcmP3B2oyFiCSF3FhYT
ETH: 0xCD715b2E3549c54A40e6ecAaFeB82138148a6c76