I've got image with ID h-plus.
When it's clicked it adds class d-block to image and close arrow.
When someone click close arrow then image and arrow dissaper.
Here's my code:
$(function() {
$("#h-plus-1").click(function() {
$('#h-image-1').addClass("d-block");
$('#h-close-arrow-1').addClass("d-block");
});
});
$(function() {
$("#h-close-arrow-1").click(function() {
$('#h-image-1').removeClass("d-block");
$('#h-close-arrow-1').removeClass("d-block");
});
});
What I try to achive is to write jQuery script which will check if h-image have class d-block and if have this class then hide it when user will click anywhere except of h-image. Some sort of lightbox but without lightbox overlay effect.
I will be grateful for your help.