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
"Untitled"
Bootstrap 4.1.1 Snippet by
dkstudio
4.1.1
Preview
HTML
JS
View Full Screen
Fork
Fork this
969
 
1 Fav
Post to Facebook
Tweet this
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel" data-wrap="false" data-interval="false"> <div class="carousel-inner"> <div class="carousel-item item active"> <img class="d-block w-100" src="https://via.placeholder.com/500x300" alt="First slide"> </div> <div class="carousel-item item"> <img class="d-block w-100" src="https://via.placeholder.com/500x300" alt="Second slide"> </div> <div class="carousel-item item"> <img class="d-block w-100" src="https://via.placeholder.com/500x300" alt="Third slide"> </div> </div> <a class="carousel-control-prev prev" href="#carouselExampleIndicators" role="button" data-slide="prev"> <span class="carousel-control-prev-icon" aria-hidden="true"></span> <span class="sr-only">Previous</span> </a> <a class="carousel-control-next next" href="#carouselExampleIndicators" role="button" data-slide="next"> <span class="carousel-control-next-icon" aria-hidden="true"></span> <span class="sr-only">Next</span> </a> </div> <div class="num"></div> </div> </div>
var totalItems = $('.item').length; var currentIndex = $('div.item.active').index() + 1; var down_index; $('.num').html(''+currentIndex+'/'+totalItems+''); $(".next").click(function(){ currentIndex_active = $('div.item.active').index() + 2; if (totalItems >= currentIndex_active) { down_index= $('div.item.active').index() + 2; $('.num').html(''+currentIndex_active+'/'+totalItems+''); } }); $(".prev").click(function(){ down_index=down_index-1; if (down_index >= 1 ) { $('.num').html(''+down_index+'/'+totalItems+''); } });
Related:
See More
Template
Paper Kit 2 PRO Angular
Questions / Comments:
Post
Posting Guidelines
Formatting
- Now
×
Close
Donate
BTC: 12JxYMYi6Vt3mx3hcmP3B2oyFiCSF3FhYT
ETH: 0xCD715b2E3549c54A40e6ecAaFeB82138148a6c76