This little script I just wrote should get you started.
What I am doing is using column-count
on the parent to break all of the images up into nice even rows, currently it is set to 3 rows but can be more or less.
(For the slideshow functionality, that is up to you. There are thousands of slideshow tutorials, plugins, etc.)
I am then taking the clicked img tag's src and turning that into a variable. The script then takes that var
and adds it through .css()
to the overlay class. Which will allow you to have an overlay of each image clicked.
The HTML Structure:
<div class="parent">
<img src="urlGoesHere" alt="img" />
<!-- Continue with the images -->
</div>
The CSS:
.parent {
width: 100%;
column-count: 3; /* controls the amount of columns */
-webkit-column-count: 3;
-moz-column-count: 3;
-o-column-count: 3;
-ms-column-count: 3;
column-gap: 5px; /* controls the spacing between each column */
-webkit-column-gap: 5px;
-moz-column-gap: 5px;
-o-column-gap: 5px;
-ms-column-gap: 5px;
position: relative;
z-index: 10;
}
The script:
$('.parent img').on('click', function() {
var imgSrc = $(this).attr('src'); // Stores the img's src into a var
$('.overlay').fadeIn().css('background-image', 'url(' + imgSrc + ')'); // Adds the stored var to the overlay class and fades it in
$('.close').on('click', function() { // The close button's functionality
$('.overlay').fadeOut(); // Hides the overlay once clicked
});
});
Here is a fiddle: Demo