I've created a listing that displays 6 results and below I have a "Show more" button that calls another query that displays 4 results. However, the results of this last query does not maintain CSS. Appears misaligned.
ThecodeIhaveisthefollowing:
<sectionid="portfolio" class="portfolio">
<div class="container">
<div class="row">
<div class="col-lg-10 col-lg-offset-1 text-center">
<h2>Portfolio</h2>
<hr class="small">
<div class="row">
<?php
$query=mysqli_query($db,"select id_album, nome, foto from albuns order by id_album ASC limit 6");
while($cat=mysqli_fetch_assoc($query)){?>
<div class="col-md-6">
<div class="portfolio-item">
<p class="imgDescription"> <?php echo $cat['nome'];?> </p>
<a>
<img class="img-portfolio img-responsive" src="<?php echo $cat['foto'];?>" onClick="location.href='listagem_album.php?ida=<?php echo $cat['id_album'];?>'">
</a>
</div>
</div>
<?php } ?>
<?php
$query=mysqli_query($db,"select id_album, nome, foto from albuns order by id_album DESC limit 4");
?><div id="fotos" style="display:none"> <?php
while($cat=mysqli_fetch_assoc($query)){?>
<div class="col-md-6">
<div class="portfolio-item">
<p class="imgDescription"> <?php echo $cat['nome'];?> </p>
<a>
<img class="img-portfolio img-responsive" src="<?php echo $cat['foto'];?>" onClick="location.href='listagem_album.php?ida=<?php echo $cat['id_album'];?>'">
</a>
</div>
</div>
<?php } ?>
</div>
</div>
<!-- /.row (nested) -->
<div id="button"><a class="btn btn-dark">View More Categories</a></div>
</div>
<!-- /.col-lg-10 -->
</div>
<!-- /.row -->
</div>
<!-- /.container -->
</section>
The button code is as follows:
<script>
$("button").click(function(){
$("#fotos").fadeIn();
$("#button").hide();
});
</script>
Thank you.