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
"Carousel + call to action button"
Bootstrap 3.3.0 Snippet by
abhijeetka
3.3.0
jQuery
Preview
HTML
CSS
JS
View Full Screen
Forked from
Fork
Fork this
Parent
545
 
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 ----------> <div class="container"> <div id="myCarousel" class="carousel slide" data-ride="carousel"> <!-- Wrapper for slides --> <div class="carousel-inner"> <div class="item active"> <a href="#"><img src="http://placehold.it/760x475/cccccc/ffffff"></a> </div><!-- End Item --> <div class="item"> <a href="#"><img src="http://placehold.it/760x475/999999/cccccc"></a> </div><!-- End Item --> <div class="item"> <a href="#"><img src="http://placehold.it/760x475/dddddd/333333"></a> </div><!-- End Item --> </div><!-- End Carousel Inner --> <ul class="list-group col-sm-4"> <li data-target="#myCarousel" data-slide-to="0" class="list-group-item active"><h4>Lorem ipsum dolor sit amet consetetur sadipscing</h4></li> <li data-target="#myCarousel" data-slide-to="1" class="list-group-item"><h4>consetetur sadipscing elitr, sed diam nonumy eirmod</h4></li> <li data-target="#myCarousel" data-slide-to="2" class="list-group-item"><h4>tempor invidunt ut labore et dolore</h4></li> <li class="list-group-item-action"><a href="#"><h4>Call to action</h4></a></li> </ul> <!-- Controls --> <div class="carousel-controls"> <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> </div><!-- End Carousel --> </div>
body { padding-top: 50px; } #myCarousel .carousel-caption { left:0; right:0; bottom:0; text-align:left; padding:10px; background:rgba(0,0,0,0.6); text-shadow:none; } #myCarousel .list-group { position:absolute; top:0; right:0; margin-right: -20px; } #myCarousel .list-group-item, #myCarousel .list-group-item-action { border-radius:0px; cursor:pointer; height: 115px; margin-bottom: 5px; border-width: 0 0 1px 0; position: relative; } #myCarousel .list-group .active { background-color:green; } #myCarousel .list-group li { padding: 20px; } #myCarousel .list-group-item-action, #myCarousel .list-group-item-action.active { background-color: blue !important; list-style: none; } @media (min-width: 992px) { #myCarousel {padding-right:33.3333%;} #myCarousel .carousel-controls {display:none;} #myCarousel .list-group .list-group-item.active::before { content: ""; position: absolute; top: 50%; left: -15px; width: 0; height: 0; margin-top: -15px; border-right: 15px solid green; border-top: 15px solid transparent; border-bottom: 15px solid transparent; } } @media (max-width: 991px) { #myCarousel .list-group { position: relative; top: auto; } #myCarousel .carousel-controls {display:none;} }
$(document).ready(function(){ var clickEvent = false; $('#myCarousel').carousel({ interval: 4000 }).on('click', '.list-group .list-group-item', function() { clickEvent = true; $('.list-group .list-group-item').removeClass('active'); $(this).addClass('active'); }).on('slid.bs.carousel', function(e) { if(!clickEvent) { var count = $('.list-group').children().length -2; var current = $('.list-group .list-group-item.active'); current.removeClass('active').next().addClass('active'); var id = parseInt(current.data('slide-to')); if(count == id) { $('.list-group .list-group-item').first().addClass('active'); } } clickEvent = false; }); });
Questions / Comments:
Post
Posting Guidelines
Formatting
- Now
×
Close
Donate
BTC: 12JxYMYi6Vt3mx3hcmP3B2oyFiCSF3FhYT
ETH: 0xCD715b2E3549c54A40e6ecAaFeB82138148a6c76