Improved modals and embedding!

This commit is contained in:
oitsjustjose 2020-02-27 22:57:16 -05:00
commit 03e6eccb71
7 changed files with 101 additions and 33 deletions

View file

@ -0,0 +1,14 @@
.embed {
position: relative;
overflow: hidden;
padding-top: 56.25%;
& iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 0;
}
}

View file

@ -1,24 +1,33 @@
.modal {
display: none;
visibility: hidden;
opacity: 0;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
position: fixed;
z-index: 1;
padding-top: 100px;
z-index: 2048;
left: 0;
top: 0;
width: 100%;
height: 100%;
width: 100vw;
height: 100vh;
overflow: auto;
background-color: $background;
background-color: rgba($background, 0.4);
transition: visibility 0s, opacity 150ms ease-in-out;
}
/* Modal Content */
.modal-content {
background-color: lighten($background, 15%);
margin: auto;
padding: 20px;
border: 1px solid lighten($background, 10%);
width: 80%;
border-radius: 8px;
box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.5);
.container {
width: 100%;

View file

@ -313,26 +313,43 @@ body {
}
.modal {
display: none;
visibility: hidden;
opacity: 0;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
position: fixed;
z-index: 1;
padding-top: 100px;
z-index: 2048;
left: 0;
top: 0;
width: 100%;
height: 100%;
width: 100vw;
height: 100vh;
overflow: auto;
background-color: #252525;
background-color: rgba(37, 37, 37, 0.4);
-webkit-transition: visibility 0s, opacity 150ms ease-in-out;
transition: visibility 0s, opacity 150ms ease-in-out;
}
/* Modal Content */
.modal-content {
background-color: #4b4b4b;
margin: auto;
padding: 20px;
border: 1px solid #3f3f3f;
width: 80%;
border-radius: 8px;
-webkit-box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.5);
box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.5);
/* The Close Button */
}
@ -569,4 +586,19 @@ li {
margin-bottom: 0.75rem;
line-height: 1.75;
}
.embed {
position: relative;
overflow: hidden;
padding-top: 56.25%;
}
.embed iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 0;
}
/*# sourceMappingURL=all.css.map */

File diff suppressed because one or more lines are too long

View file

@ -3,3 +3,4 @@
@import "menu";
@import "modal";
@import "main";
@import "embed";

View file

@ -2,23 +2,24 @@ $(document).ready(() => {
// Close when clicking on *not* the modal-contents
window.onclick = (event) => {
if (event.target.classList.contains("modal")) {
$(event.target).slideUp(150);
event.target.style.visibility = 'hidden';
event.target.style.opacity = 0;
document.body.classList.remove("no-scroll");
}
};
document.querySelectorAll(".modal .close").forEach((closeBtn) => {
closeBtn.addEventListener('click', (evt) => {
$(closeBtn.parentElement.parentElement).slideUp(150);
// closeBtn.parentElement.parentElement.style.display = 'none';
closeBtn.parentElement.parentElement.style.visibility = 'hidden';
closeBtn.parentElement.parentElement.style.opacity = 0;
document.body.classList.remove("no-scroll");
});
});
document.querySelectorAll("[for-modal]").forEach((modalTrigerEl) => {
modalTrigerEl.addEventListener('click', (evt) => {
$(`#${modalTrigerEl.getAttribute("for-modal")}`).slideDown(150);
// document.getElementById().style.display = "block";
document.getElementById(modalTrigerEl.getAttribute("for-modal")).style.visibility = "visible";
document.getElementById(modalTrigerEl.getAttribute("for-modal")).style.opacity = 1;
document.body.classList.add("no-scroll");
});
});