I have created a custom lightbox with the following HTML:
<a href="#" class="lightbox">
<img src="thumbnail.jpg" />
<div class="box">
<img class="boximage" src="full-image.jpg" />
<p>Caption</p>
<div class="close"><p>x</p></div>
</div>
</a>
The following JavaScript opens the correct individual full .boximage
class image when that individual thumbnail with .lightbox
class is clicked on.
$('.lightbox').click(function(){
$(this).find('.box, .boximage').css('display', 'block');
});
Previously I had some JavaScript which works to close the lightbox when you click on the close x.
$('.close').click(function(){
$('.box, .boximage').css('display', 'none');
});
But I can't seem to get the close lightbox to work.
How do I make the close functionality work?