Skip to content

Instantly share code, notes, and snippets.

@rasy-js
Last active August 29, 2015 14:23
Show Gist options
  • Save rasy-js/49179ff3c44c370ebc49 to your computer and use it in GitHub Desktop.
Save rasy-js/49179ff3c44c370ebc49 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Popup</title>
<style>
.popup-overlay {
position: fixed;
z-index: 999;
top: 0px;
left: 0px;
display: none;
width: 100%;
height: 100%;
text-align: center;
background: rgba(0, 0, 0, 0.7) none repeat scroll 0% 0%;
}
.popup {
position: absolute;
min-width: 330px;
vertical-align: middle;
background: #FFF none repeat scroll 0% 0%;
border: 5px solid rgb(255, 216, 0);
box-shadow: 0 0 2px 1px #000;
padding-top: 40px;
> div {
margin-bottom: 15px;
> i {
font-size: em(15);
margin-right: 10px;
color: $green;
width: 15px;
}
}
}
.fa.fa-mobile {
font-size: em(18);
}
.popup-close {
line-height: 12px;
position: absolute;
display: block;
padding: 8px;
cursor: pointer;
text-align: center;
text-decoration: none;
top: -7px;
right: 13px;
width: 12px;
height: 12px;
font-size: 24px;
color: rgb(0, 0, 0);
font-weight: bold;
color: $green;
&:hover {
color: $green2;
}
}
.callback {
position: relative;
input[type=text] {
width: 80%;
height: 33px;
border-radius: 0;
border: 1px solid #A8A8A8;
outline: 0;
padding: 0;
background: #fff;
text-indent: 10px;
}
.submit-btn {
width: 100%;
position: relative;
bottom: 0;
left: 0;
}
input[type=submit] {
display: inline-block;
text-align: center;
color: #fff;
background: $green;
padding: 4px 15px;
border: 0;
color: #fff;
text-transform: uppercase;
font-size: em(18);
font-weight: normal;
&:hover {
color: #000;
background: $yellow;
}
}
input.error {
background: url(../img/icon-fail.png) no-repeat right center #ffebef;
}
}
.my-message {
margin-top: 10px;
font-size: em(15);
margin-bottom: 15px !important;
}
.form-error {
display: none;
}
.message-load.err {
color: red;
}
.message-load.suc {
color: green;
}
</style>
<script>
function popup() {
var top = ($(window).height() - $('.popup').outerHeight()) / 2;
var left = ($(window).width() - $('.popup').outerWidth()) / 2;
$('.popup').css({
'top': top,
'left' : left
});
}
p = $('.popup-overlay')
$('.popup-toggle').click(function() {
p.css('display', 'block');
popup();
});
p.click(function(event) {
e = event || window.event
if (e.target == this) {
$(p).css('display', 'none');
}
});
$('.popup-close').click(function() {
p.css('display', 'none');
return false;
});
</script>
</head>
<body>
<div class="popup-overlay">
<div class="popup">
<div class="popup-close">Modal</div>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment