"Expandable images"
Bootstrap 4.0.0 Snippet by 36864

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/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="row"> <div class="col-3 img-expandable ml-auto"> <img class="img-fluid w-100" src="http://placehold.it/500x500"> <div class="overlay-text"> Image 1 selected </div> </div> <div class="col-3 img-expandable"> <img class="img-fluid w-100" src="http://placehold.it/500x500"> <div class="overlay-text"> Image 2 selected </div> </div> <div class="col-3 img-expandable mr-auto"> <img class="img-fluid w-100" src="http://placehold.it/500x500"> <div class="overlay-text"> Image 3 selected </div> </div> </div>
.overlay-text { position: absolute; top: 40%; width: 100%; text-align: center; visibility: hidden; } .col-4 .overlay-text { visibility: visible; }
$(document).ready(function () { $(".img-expandable").click(function() { if($(this).hasClass("col-4")) { $(".img-expandable").removeClass("col-4").removeClass("col-2").addClass("col-3"); } else { $(".img-expandable").removeClass("col-4").removeClass("col-3").addClass("col-2"); $(this).removeClass("col-2").addClass("col-4"); } }); });

Related: See More


Questions / Comments: