Skip to content

Instantly share code, notes, and snippets.

@attilaking
Last active April 6, 2020 09:54
Show Gist options
  • Save attilaking/7c171252d477cb1277eb7d21cc2b0a33 to your computer and use it in GitHub Desktop.
Save attilaking/7c171252d477cb1277eb7d21cc2b0a33 to your computer and use it in GitHub Desktop.
[CSS JS MODAL] Modal #modal #popup
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
/* MODAL*/
#ymg-modal {
position: relative;
left: 0;
right: 0;
top: 20%;
margin-left: auto;
margin-right: auto;
width: 50%;
background-color: white;
box-shadow: 10px 10px 10px 10px #000;
-webkit-box-shadow: 0px 0px 29px 0px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 0px 0px 29px 0px rgba(0, 0, 0, 0.75);
box-shadow: 0px 0px 29px 0px rgba(0, 0, 0, 0.75);
font-family: 'Open Sans', sans-serif;
}
#ymg-modal-header {
position: relative;
display: block;
box-sizing: border-box;
padding: 15px;
width: 100%;
background-color: #f2f2f2;
text-transform: uppercase;
font-size: 23px;
text-align: left;
}
#ymg-modal-content {
position: relative;
display: block;
box-sizing: border-box;
padding: 15px;
font-size: 17px;
text-align: left;
}
@media only screen and (max-width: 600px) {
#ymg-modal {
top: 5%;
margin-left: auto;
margin-right: auto;
width: 95%;
}
#ymg-modal-content {
font-size: 15px;
}
}
</style>
</head>
<body>
<div class="ymg-info-div">
<span>TO SEE FULL DESCRIPTION OF EACH ACTIVITY LEVEL CLICK HERE: </span>
<span style="cursor: pointer;" onclick="ymgShowModal(this.id)" id="ymgmod1">&#9432;</span>
</div>
<!--MODAL1 -->
<div style="display:none;position: fixed;top: 0;left: 0;width: 100%;height: 100%;z-index: 100;"
id="ymg-modal-divymgmod1">
<div id="ymg-modal">
<div id="ymg-modal-header">
ACTIVITY LEVELS
</div>
<div id="ymg-modal-content">
<p><b>Loose Weight/Fat Loss:</b> </p>
<ul>
<li>I have more than 10 pounds of fat to loss</li>
</ul>
<p><b>Get Lean/Maintain Weight</b></p>
<ul>
<li>I have 10-15 pounds or less to loose</li>
<li>I do not wish to loose weight, I want to gain lean muscle and maintain my
current weight</li>
</ul>
<p><b>Build Muscle</b></p>
<ul>
<li>I want to gain muscle</li>
</ul>
</div>
</div>
</div>
<!--END MODAL -->
<script>
// MODAL
function ymgShowModal(modalid) {
var modDiv = document.getElementById('ymg-modal-div' + modalid);
modDiv.addEventListener("click", function (event) {
modDiv.style.display = "none"
});
modDiv.style.display = "block"
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment