Last active
February 27, 2019 02:23
-
-
Save adamdehaven/c99dc5e168b862bce9c5da5fc7d11a02 to your computer and use it in GitHub Desktop.
Modal code for a friend
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a class="louarcade-show-modal" href="#">Open Modal</a> | |
<div class="louarcade-modal-overlay"> | |
<div class="louarcade-modal-container"> | |
<div class="louarcade-modal-content"> | |
<button class="louarcade-modal-x louarcade-hide-modal">×</button> | |
Insert modal content. | |
</div> | |
</div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
$('.louarcade-show-modal').on('click', function (event) { | |
event.preventDefault(); | |
$('html, body').addClass('no-scroll'); | |
$('.louarcade-modal-overlay').fadeIn(300); | |
}); | |
var louarcade_closeModal = function () { | |
$('html, body').removeClass('no-scroll'); | |
$('.louarcade-modal-overlay').fadeOut(300); | |
}; | |
// clicking in the space outside the modal content area hides the modal: | |
$('.louarcade-modal-content').on('click', function (event) { | |
event.stopPropagation(); | |
}); | |
$('.louarcade-modal-overlay').on('click', function (event) { | |
louarcade_closeModal(); | |
}); | |
$('.louarcade-hide-modal').on('click', function (event) { | |
event.preventDefault(); | |
louarcade_closeModal(); | |
}); | |
})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body.no-scroll{overflow:hidden}.louarcade-modal-overlay{display:none;position:fixed;top:0;bottom:0;left:0;right:0;z-index:1000;width:100%;height:100%;background:rgba(0,0,0,0.9);overflow:auto}.louarcade-modal-overlay .louarcade-modal-container{position:absolute;top:50%;left:0;right:0;-webkit-transform:translate(0, -50%);transform:translate(0, -50%);max-height:100%;padding:15px}.louarcade-modal-overlay .louarcade-modal-content{position:relative;background:white;margin:0 auto;padding:50px 50px 40px 40px;min-height:100px;width:85%;max-width:800px}@media (min-width: 992px){.louarcade-modal-overlay .louarcade-modal-content{width:75%;max-width:1000px}}.louarcade-modal-overlay .louarcade-modal-x{position:absolute;top:10px;right:10px;width:40px;height:40px;display:block;color:black;border:0;background:transparent;line-height:1;font-size:40px;text-align:center;cursor:pointer;outline:none}.louarcade-modal-overlay .louarcade-modal-x:hover,.louarcade-modal-overlay .louarcade-modal-x:focus{color:gray;-webkit-transition:color 0.2s fade-in-out;transition:color 0.2s fade-in-out} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body.no-scroll { | |
overflow: hidden; | |
} | |
.louarcade-modal-overlay { | |
display: none; | |
position: fixed; | |
top: 0; | |
bottom: 0; | |
left: 0; | |
right: 0; | |
z-index: 1000; | |
width: 100%; | |
height: 100%; | |
background: rgba(0, 0, 0, 0.9); | |
overflow: auto; | |
.louarcade-modal-container { | |
position: absolute; | |
top: 50%; | |
left: 0; | |
right: 0; | |
transform: translate(0, -50%); | |
max-height: 100%; | |
padding: 15px; | |
} | |
.louarcade-modal-content { | |
position: relative; | |
background: white; | |
margin: 0 auto; | |
padding: 50px 50px 40px 40px; | |
min-height: 100px; | |
width: 85%; | |
max-width: 800px; | |
@media (min-width: 992px) { | |
width: 75%; | |
max-width: 1000px; | |
} | |
} | |
.louarcade-modal-x { | |
position: absolute; | |
top: 10px; | |
right: 10px; | |
width: 40px; | |
height: 40px; | |
display: block; | |
color: black; | |
border: 0; | |
background: transparent; | |
line-height: 1; | |
font-size: 40px; | |
text-align: center; | |
cursor: pointer; | |
outline: none; | |
&:hover, | |
&:focus { | |
color: gray; | |
transition: color 0.2s fade-in-out; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment