Skip to content

Instantly share code, notes, and snippets.

@LucasAndrad
Last active October 13, 2018 22:11
Show Gist options
  • Save LucasAndrad/f3e874e5984a317552e552160706b78b to your computer and use it in GitHub Desktop.
Save LucasAndrad/f3e874e5984a317552e552160706b78b to your computer and use it in GitHub Desktop.
js code of generic modal
function openModal() {
var modal = document.getElementById('gmModal');
modal.style.display = "block";
}
function closeModal() {
var modal = document.getElementById('gmModal');
modal.style.display = "none";
}
window.onclick = function(event) {
var modal = document.getElementById('gmModal');
if (event.target == modal) {
modal.style.display = "none";
}
}
.modal {
display: none;
position: fixed;
z-index: 1;
padding-top: 100px;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgb(0,0,0);
background-color: rgba(0,0,0,0.4);
}
.modal-content {
background-color: #fefefe;
margin: auto;
padding: 10px 20px;
width: 50%;
border-radius: 5px;
min-height: 100px;
}
.close {
color: #aaaaaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
.btn-open-modal {
border: 1px solid #ffffff;
padding: 10px 30px;
border-radius: 10px;
font-weight: bold;
cursor: pointer;
transition: 0.3s;
font-size: 100%;
}
.btn-open-modal:hover {
background: #c6c6c6;
}
.gm-header {
margin-bottom: 0px;
border-bottom: 1px solid #d1d1d1;
}
.gm-title {
}
.gm-body {
margin-top: 20px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment