I have implemented the Materialize CSS "Material Box" lightbox plugin, but I am facing an issue. I want all the thumbnails to be uniform in size, and when clicked, the full photo should be displayed.
Currently, I am using the onclick
function to change the image source. However, I am unsure how to revert back to the thumbnail image once the large photo is closed (either by clicking or pressing the escape key).
<div class="col s6 m3">
<img class="materialboxed responsive-img" src="images/thumb1.jpg" onclick='this.src="images/photo1"'>
</div>
Here is the Material Box JavaScript code:
document.addEventListener('DOMContentLoaded', function() {
var elems = document.querySelectorAll('.materialboxed');
var options = {}
var instances = M.Materialbox.init(elems, options);
});
// Using jQuery
$(document).ready(function(){
$('.materialboxed').materialbox();
});
You can find more information about Materialize CSS at
I have explored various options, but haven't found a straightforward way to achieve the desired lightbox effect with cropped square thumbnails. Any suggestions or tips would be greatly appreciated!