"Auto adjust images height gallery"
Bootstrap 3.3.0 Snippet by sang-d

<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 class="row"> <h2>Gallery with auto adjust all images height to first item</h2> <div class="col-lg-3 col-sm-4 col-xs-6"><a title="Image 1" href="#"><img class="thumbnail img-responsive" src="//placehold.it/600x350"></a></div> <div class="col-lg-3 col-sm-4 col-xs-6"><a title="Image 2" href="#"><img class="thumbnail img-responsive" src="//placehold.it/600x350/2255EE"></a></div> <div class="col-lg-3 col-sm-4 col-xs-6"><a title="Image 3" href="#"><img class="thumbnail img-responsive" src="http://www.thegoldenscope.com/wp-content/uploads/2014/04/le-sorgenti021.jpg"></a></div> <div class="col-lg-3 col-sm-4 col-xs-6"><a title="Image 4" href="#"><img class="thumbnail img-responsive" src="//placehold.it/600x350/992233"></a></div> <div class="col-lg-3 col-sm-4 col-xs-6"><a title="Image 5" href="#"><img class="thumbnail img-responsive" src="https://upload.wikimedia.org/wikipedia/commons/d/dd/Big_&_Small_Pumkins.JPG"></a></div> <div class="col-lg-3 col-sm-4 col-xs-6"><a title="Image 6" href="#"><img class="thumbnail img-responsive" src="https://peach.blender.org/wp-content/uploads/big_big_buck_bunny_small.jpg?x11217"></a></div> </div> </div>
.thumbnail {margin-bottom:6px;}
$(document).ready(function() { var imgs = $(".container").find("img.thumbnail"); var h = $(imgs[0]).height() for(var i = 1; i < imgs.length; i++) { var img = $(imgs[i]); img.height(h); } });

Related: See More


Questions / Comments: