Just extending the rest of the answers a bit
Use fadeIn()
and fadeOut()
inthis way to achieve the kind of effect you want both for 'close button' and for clicking on overlay
Check the FIDDLE
$(".showpop").click(function(){
$("#light").fadeIn();
$("#fade").fadeIn();
});
$(".hidepop").click(function(){
$("#light").fadeOut();
$("#fade").fadeOut();
});
$(".black_overlay").click(function() { $(this).fadeOut(); $("#light").fadeOut(); });