I am working on a page that contains hidden fullscreen divs. My goal is to be able to open these divs individually by clicking on the corresponding button and close them by clicking the "close" button inside the div.
Currently, I am able to open a div successfully, but when I try to close it, the next one automatically opens without giving me the option to close it.
Below is an excerpt of my code:
$(".button").click(function() {
$(".overlay").addClass("overlay-open");
$(".closeoverlay").click(function() {
$("#overlay1").removeClass("overlay-open");
$(".overlay").addClass( "overlay-close" );
});
To see a clearer demonstration, check out this Fiddle: http://jsfiddle.net/xq2gw50d/