<!-- Trigger/Open The Modal -->
<button id="myBtn">Open Modal</button>
<!-- The Modal -->
<div id="myModal" class="modal">
<!-- Modal content -->
<div class="modal-content">
<h1>
Hi!
</h1>
<p>Welcome to the Apigee Edge Early Access Program. Some things around here might not work as you expect them to — that’s because we’re working around the clock to bring you a better experience.</p>
<p>Got feedback? Use the feedback button at the bottom
of each page to tell us what you think. For help, see the <a href="#">beta documentation.</a></p>
<button id="accept">
I understand and agree
</button>
<a class="safety" href="https://enterprise.apigee.com" target="_blank">Take me back to safety!</a>
<div id="myModal" class="modal">
<!-- Modal content -->
<div class="modal-content">
<h1>
Hi!
</h1>
<p>Welcome to the Apigee Edge Early Access Program. Some things around here might not work as you expect them to — that’s because we’re working around the clock to bring you a better experience.</p>
<p>Got feedback? Use the feedback button at the bottom
of each page to tell us what you think. For help, see the <a href="#">beta documentation.</a></p>
</div></div>
</div>
</div>
CSS
/* The Modal (background) */
.modal {
display: block;
/* Hidden by default */
position: fixed;
/* Stay in place */
z-index: 1;
/* Sit on top */
left: 0;
top: 0;
width: 100%;
/* Full width */
height: 100%;
/* Full height */
overflow: auto;
/* Enable scroll if needed */
background-color: rgb(0, 0, 0);
/* Fallback color */
background-color: rgba(0, 0, 0, 0.4);
/* Black w/ opacity */
}
/* Modal Content/Box */
.modal-content {
color: #414242;
margin: 15% auto;
/* 15% from the top and centered */
padding: 30px 60px;
width: 500px;
/* Could be more or less, depending on screen size */
font-family: Lato;
font-size: 16px;
line-height: 28px;
letter-spacing: 0.5px;
-webkit-font-smoothing: antialiased;
/* Rectangle 2 Copy 3: */
background: #FFFFFF;
border: 1px solid #9B9C9D;
box-shadow: 0px 2px 6px 0px rgba(0,0,0,0.20);
border-radius: 6px;
}
.modal-content a {
color: #636464;
}
.modal-content > h1 {
display: block;
width: 100%;
text-align: center;
}
button#accept {
margin: 30px auto;
display: block;
border: 1px solid #fc4c02;
border-radius: 3px;
background: #fff;
color: #fc4c02;
font-size: 16px;
height: 48px;
padding: 0 20px;
cursor: pointer;
}
.safety {
color: #9B9C9D;
font-size: 12px;
text-align: center;
display: block;
text-decoration: none;
}
JavaScript
// Get the modal
var modal = document.getElementById('myModal');
// Get the button that opens the modal
var btn = document.getElementById("myBtn");
// Get the <span> element that closes the modal
var accept = document.getElementById("accept");
// When the user clicks on the button, open the modal
btn.onclick = function() {
modal.style.display = "block";
}
// When the user clicks on <span> (x), close the modal
accept.onclick = function() {
modal.style.display = "none";
}
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.