Skip to content

Instantly share code, notes, and snippets.

@tessalt
Created November 16, 2012 15:19
Show Gist options
  • Save tessalt/4088131 to your computer and use it in GitHub Desktop.
Save tessalt/4088131 to your computer and use it in GitHub Desktop.
sometimes-useful modal shit
.overlay {
display: none;
position: absolute;
top: 0;
left:0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.6);
z-index: 20;
}
.request-modal {
display: none;
width: 400px;
position: relative;
margin: 90px auto 0 auto;
background: #fff;
padding: 20px;
z-index: 25;
border-radius: 5px;
}
$("#trigger").click(function(e){
e.preventDefault();
$(".overlay").fadeIn();
$(".modal").show();
});
$(".overlay").click(function(e){
if (!($(e.target).parents(".modal").length > 0)) {
$(this).fadeOut();
}
});
$(".modal").click(function(e){
e.stopPropagation();
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment