Skip to content

Instantly share code, notes, and snippets.

@MonteLogic
Created December 31, 2021 20:21
Show Gist options
  • Save MonteLogic/691933cb91c8126a43876c581e2978ef to your computer and use it in GitHub Desktop.
Save MonteLogic/691933cb91c8126a43876c581e2978ef to your computer and use it in GitHub Desktop.
change JS Solution
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="javascript.js"></script>
jQuery(document).ready(function( $ ){
var content = `<div id='empirePopup' class='modal'>
<div class='modal-content'>
<span class='close'>×</span>
<div id='empireContent'>
<h2><i>Introducing DeKalb by Empire Office</i></h2>
<h4>Leading Commercial Furniture & Interior Solutions Provider Empire Office Has Acquired DeKalb Office.</h4>
<p>Bringing increased resources, proven insights and an enhanced range of services to provide an even greater level of support for our clients in Atlanta, Birmingham, and beyond.</p>
<h5>Learn More:</h5>
<div class="button-bar">
<div><a href="https://www.empireoffice.com/announcing-empire-offices-acquisition-of-dekalb-office/">Read the Press Release</a></div>
<div><a href="https://www.empireoffice.com/">Go to empireoffice.com</a></div>
<div><a href="https://www.empireoffice.com/subscriber">Subscribe to Stay Informed</a></div>
</div>
</div>
</div>
</div><style>
@import url("css/austinfontface.css");
h2, h4, p, h5 {
text-align: center;
}
h2 {
font-family: 'Austin-SemiboldItalic';
color: #3064AA;
font-weight: 600;
padding-bottom: 35px;
}
h4 {
font-size: 20px;
font-weight: bold;
padding-bottom: 35px;
max-width: 500px;
margin: 0 auto;
}
h5 {
text-transform: uppercase;
font-size: 16px;
font-weight: bold;
padding-bottom: 35px;
letter-spacing: 6px;
}
p {
padding-bottom: 25px;
max-width: 500px;
margin: 0 auto;
}
.button-bar {
display: flex;
gap: 10px;
flex-direction: row;
align-items: center;
justify-content: center;
}
.button-bar div {
color: white;
text-transform: uppercase;
background-color: black;
padding: 15px 20px;
text-align: center;
line-height: 1;
}
.button-bar div a {
color: white;
text-align: center;
letter-spacing: 6px;
font-size: 12px;
line-height: 1.25;
font-weight:600;
}
@media (max-width: 800px) {
.button-bar {
flex-direction: column;
}
}
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 999; /* 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 {
background-color: #fefefe;
margin: 15% auto; /* 15% from the top and centered */
padding: 20px;
border: 1px solid #888;
width: 50%; /* Could be more or less, depending on screen size */
min-width: 400px;
max-width: 768px;
width: 100%;
}
/* The Close Button */
.close {
color: #aaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: black;
text-decoration: none;
cursor: pointer;
}
</style>`;;
$(document.body).append(content);
$("#empirePopup").show();
var modal = document.getElementById("empirePopup");
var span = document.getElementsByClassName("close")[0];
span.onclick = function() {
modal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment