almaz-b
6/19/2017 - 10:38 PM

Hide popup if click detected elsewhere

Hide popup if click detected elsewhere

// If an event gets to the body
$("body").click(function(){
  $(".popup").fadeOut().removeClass("active");
});

// Prevent events from getting pass .popup
$(".popup").click(function(e){
  e.stopPropagation();
});