Personal I made a gallery of photos a little big so I added an effect of slice
in it are 64 images in the case when the site loads only appears 12 and when the user clicks on see more is appearing from 12 to 12 it works normally follows the effect script:
$(".images-spaces").slice(0, 12).show();
$("#loadMore-photos").on('click', function (e) {
e.preventDefault();
$(".images-spaces:hidden").slice(0, 12).slideDown();
if ($(".images-spaces:hidden").length == 0) {
$("#load").fadeOut('slow');
}
});
The problem is that all 64 images load together with the site and to optimize this I wanted to load only the first 12 that are the ones I left showing initially and wanted the following images not to be loaded when accessing the site and yes only when I click on the button to see more photos:
<li class="col-md-2 no-padding all deck images-spaces" data-src="assets/images/gallery/deck-05.jpg">
<a href="assets/images/gallery/deck-05.jpg">
<img class="img-responsive" src="assets/images/gallery/deck-05.jpg" alt="Deck" />
<div class="gallery-ecoresort-poster">
<p>Deck</p>
</div>
</a>
</li>
<a href="#" id="loadMore-photos">Ver mais fotos</a>
ai in case I would be loading from 12 to 12 I would like to know if it is possible to do this with this current gallery that I have.