I have just started to use the masonry plugin but I cannot get it to work. Below is a picture of the problem.
As you can see this is not the desired effect. Below is my code that I am using:
CONTENT
<div class="container" id="reviews">
<div class="row">
<div class="comment-block">
<div class="new-comment"></div>
<?php
while($row = mysqli_fetch_array($result)) {
$data = mysqli_fetch_array(mysqli_query($con, "SELECT first_name, last_name FROM transactions WHERE order_id = '{$row['order_id']}'"));
$name = $data['first_name']. ' '. mb_substr($data['last_name'], 0, 1);
if($row['rating'] == 5) $star = '<span class="glyphicon glyphicon-star review_star"></span><span class="glyphicon glyphicon-star review_star"></span><span class="glyphicon glyphicon-star review_star"></span><span class="glyphicon glyphicon-star review_star"></span><span class="glyphicon glyphicon-star review_star"></span>';
if($row['rating'] == 4) $star = '<span class="glyphicon glyphicon-star review_star"></span><span class="glyphicon glyphicon-star review_star"></span><span class="glyphicon glyphicon-star review_star"></span><span class="glyphicon glyphicon-star review_star"></span>';
if($row['rating'] == 3) $star = '<span class="glyphicon glyphicon-star review_star"></span><span class="glyphicon glyphicon-star review_star"></span><span class="glyphicon glyphicon-star review_star"></span>';
if($row['rating'] == 2) $star = '<span class="glyphicon glyphicon-star review_star"></span><span class="glyphicon glyphicon-star review_star"></span>';
if($row['rating'] == 1) $star = '<span class="glyphicon glyphicon-star review_star"></span>';
?>
<div class="col-md-4">
<div id="box_review">
<h3><?php echo $star; ?></h3>
<h5 class="thin"><?php echo $row['date'] ?></h5>
<blockquote>
<p><?php echo $row['comment'] ?></p>
<footer><?php echo $name ?></footer>
</blockquote>
</div>
</div>
<?php } ?>
</div><!-- ./ comments block -->
</div><!-- ./ row -->
</div><!-- ./ container -->
MASONRY
$(document).ready(function() {
$('#reviews').masonry({
columnWidth: 400,
itemSelector: '#box_review'
}).imagesLoaded(function() {
$('#reviews').masonry('reload');
});
});
Please can you help me with what I am doing wrong? I am using Bootstrap for the grid system as well by the way I am not sure if that might be the problem. Thanks.