"Untitled"
Bootstrap 4.1.1 Snippet by dkstudio

<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


Questions / Comments: