Improved modals and embedding!
This commit is contained in:
parent
e40807b623
commit
03e6eccb71
7 changed files with 101 additions and 33 deletions
14
Libraries/css/themekit/_embed.scss
Normal file
14
Libraries/css/themekit/_embed.scss
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,24 +1,33 @@
|
||||||
.modal {
|
.modal {
|
||||||
display: none;
|
visibility: hidden;
|
||||||
|
opacity: 0;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 1;
|
z-index: 2048;
|
||||||
padding-top: 100px;
|
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
width: 100%;
|
width: 100vw;
|
||||||
height: 100%;
|
height: 100vh;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
background-color: $background;
|
background-color: $background;
|
||||||
background-color: rgba($background, 0.4);
|
background-color: rgba($background, 0.4);
|
||||||
|
transition: visibility 0s, opacity 150ms ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Modal Content */
|
/* Modal Content */
|
||||||
.modal-content {
|
.modal-content {
|
||||||
background-color: lighten($background, 15%);
|
background-color: lighten($background, 15%);
|
||||||
margin: auto;
|
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
border: 1px solid lighten($background, 10%);
|
border: 1px solid lighten($background, 10%);
|
||||||
width: 80%;
|
width: 80%;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.5);
|
||||||
|
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
||||||
|
|
@ -313,26 +313,43 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal {
|
.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;
|
position: fixed;
|
||||||
z-index: 1;
|
z-index: 2048;
|
||||||
padding-top: 100px;
|
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
width: 100%;
|
width: 100vw;
|
||||||
height: 100%;
|
height: 100vh;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
background-color: #252525;
|
background-color: #252525;
|
||||||
background-color: rgba(37, 37, 37, 0.4);
|
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 */
|
||||||
.modal-content {
|
.modal-content {
|
||||||
background-color: #4b4b4b;
|
background-color: #4b4b4b;
|
||||||
margin: auto;
|
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
border: 1px solid #3f3f3f;
|
border: 1px solid #3f3f3f;
|
||||||
width: 80%;
|
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 */
|
/* The Close Button */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -569,4 +586,19 @@ li {
|
||||||
margin-bottom: 0.75rem;
|
margin-bottom: 0.75rem;
|
||||||
line-height: 1.75;
|
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 */
|
/*# sourceMappingURL=all.css.map */
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -3,3 +3,4 @@
|
||||||
@import "menu";
|
@import "menu";
|
||||||
@import "modal";
|
@import "modal";
|
||||||
@import "main";
|
@import "main";
|
||||||
|
@import "embed";
|
||||||
|
|
|
||||||
|
|
@ -2,23 +2,24 @@ $(document).ready(() => {
|
||||||
// Close when clicking on *not* the modal-contents
|
// Close when clicking on *not* the modal-contents
|
||||||
window.onclick = (event) => {
|
window.onclick = (event) => {
|
||||||
if (event.target.classList.contains("modal")) {
|
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.body.classList.remove("no-scroll");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
document.querySelectorAll(".modal .close").forEach((closeBtn) => {
|
document.querySelectorAll(".modal .close").forEach((closeBtn) => {
|
||||||
closeBtn.addEventListener('click', (evt) => {
|
closeBtn.addEventListener('click', (evt) => {
|
||||||
$(closeBtn.parentElement.parentElement).slideUp(150);
|
closeBtn.parentElement.parentElement.style.visibility = 'hidden';
|
||||||
// closeBtn.parentElement.parentElement.style.display = 'none';
|
closeBtn.parentElement.parentElement.style.opacity = 0;
|
||||||
document.body.classList.remove("no-scroll");
|
document.body.classList.remove("no-scroll");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
document.querySelectorAll("[for-modal]").forEach((modalTrigerEl) => {
|
document.querySelectorAll("[for-modal]").forEach((modalTrigerEl) => {
|
||||||
modalTrigerEl.addEventListener('click', (evt) => {
|
modalTrigerEl.addEventListener('click', (evt) => {
|
||||||
$(`#${modalTrigerEl.getAttribute("for-modal")}`).slideDown(150);
|
document.getElementById(modalTrigerEl.getAttribute("for-modal")).style.visibility = "visible";
|
||||||
// document.getElementById().style.display = "block";
|
document.getElementById(modalTrigerEl.getAttribute("for-modal")).style.opacity = 1;
|
||||||
document.body.classList.add("no-scroll");
|
document.body.classList.add("no-scroll");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
38
index.html
38
index.html
|
|
@ -28,16 +28,13 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="compact item" for-modal="aboutModal">
|
<div class="compact item" for-modal="aboutModal">
|
||||||
About
|
<span>About <i class="fa fa-info"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="compact item">
|
<a href="https://github.com/oitsjustjose/ThemeKit" target="_blank" class="compact item">
|
||||||
Github
|
<span>GitHub <i class="fa fa-github"></i></span>
|
||||||
</div>
|
</a>
|
||||||
<div class="compact item">
|
<div class="compact item" for-modal="ytModal">
|
||||||
Reddit
|
<span>YouTube <i class="fa fa-youtube-play"></i></span>
|
||||||
</div>
|
|
||||||
<div class="compact item">
|
|
||||||
YouTube
|
|
||||||
</div>
|
</div>
|
||||||
<div class="compact submenu item" onclick="toggleSubMenu(this)">
|
<div class="compact submenu item" onclick="toggleSubMenu(this)">
|
||||||
<span>
|
<span>
|
||||||
|
|
@ -69,11 +66,8 @@
|
||||||
<a href="https://github.com/oitsjustjose/ThemeKit" target="_blank" class="item">
|
<a href="https://github.com/oitsjustjose/ThemeKit" target="_blank" class="item">
|
||||||
<span>GitHub <i class="fa fa-github"></i></span>
|
<span>GitHub <i class="fa fa-github"></i></span>
|
||||||
</a>
|
</a>
|
||||||
<div class="item">
|
<div class="item" for-modal="ytModal">
|
||||||
Reddit
|
<span>YouTube <i class="fa fa-youtube-play"></i></span>
|
||||||
</div>
|
|
||||||
<div class="item">
|
|
||||||
YouTube
|
|
||||||
</div>
|
</div>
|
||||||
<div class="dropdown item">
|
<div class="dropdown item">
|
||||||
<span>
|
<span>
|
||||||
|
|
@ -292,6 +286,22 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="ytModal" class="modal">
|
||||||
|
<div class="modal-content">
|
||||||
|
<span class="close">
|
||||||
|
<i class="fa fa-close"></i>
|
||||||
|
</span>
|
||||||
|
<h2>
|
||||||
|
YouTube Embed Demo In A Modal
|
||||||
|
</h2>
|
||||||
|
<div class="embed">
|
||||||
|
<iframe src="https://www.youtube.com/embed/IFfLCuHSZ-U" frameborder="0"
|
||||||
|
allow="accelerometer;; encrypted-media; gyroscope; picture-in-picture" allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
Loading…
Reference in a new issue