Modal and such!

This commit is contained in:
oitsjustjose 2020-02-27 22:24:10 -05:00
commit e40807b623
7 changed files with 95 additions and 26 deletions

View file

@ -123,7 +123,6 @@ img {
}
}
.divider {
width: 70vw;
height: 10px;
@ -155,3 +154,14 @@ img {
transform: translateY(-15px);
}
}
ul {
padding-inline-start: 0;
padding-inline-end: 40px;
}
li {
margin-top: 0.75rem;
margin-bottom: 0.75rem;
line-height: 1.75;
}

View file

@ -1,15 +1,15 @@
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
padding-top: 100px; /* Location of the box */
display: none;
position: fixed;
z-index: 1;
padding-top: 100px;
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: $background; /* Fallback color */
background-color: rgba($background, 0.4); /* Black w/ opacity */
width: 100%;
height: 100%;
overflow: auto;
background-color: $background;
background-color: rgba($background, 0.4);
}
/* Modal Content */
@ -20,6 +20,11 @@
border: 1px solid lighten($background, 10%);
width: 80%;
.container {
width: 100%;
height: 100%;
}
/* The Close Button */
.close {
color: #aaaaaa;

View file

@ -314,25 +314,16 @@ body {
.modal {
display: none;
/* Hidden by default */
position: fixed;
/* Stay in place */
z-index: 1;
/* Sit on top */
padding-top: 100px;
/* Location of the box */
left: 0;
top: 0;
width: 100%;
/* Full width */
height: 100%;
/* Full height */
overflow: auto;
/* Enable scroll if needed */
background-color: #252525;
/* Fallback color */
background-color: rgba(37, 37, 37, 0.4);
/* Black w/ opacity */
}
/* Modal Content */
@ -345,6 +336,11 @@ body {
/* The Close Button */
}
.modal-content .container {
width: 100%;
height: 100%;
}
.modal-content .close {
color: #aaaaaa;
float: right;
@ -560,4 +556,17 @@ img.large {
transform: translateY(-15px);
}
}
ul {
-webkit-padding-start: 0;
padding-inline-start: 0;
-webkit-padding-end: 40px;
padding-inline-end: 40px;
}
li {
margin-top: 0.75rem;
margin-bottom: 0.75rem;
line-height: 1.75;
}
/*# sourceMappingURL=all.css.map */

File diff suppressed because one or more lines are too long

View file

@ -42,10 +42,8 @@ const toggleMenu = () => {
if (visible) {
document.body.classList.add("no-scroll");
console.log("not visible");
} else {
document.body.classList.remove("no-scroll");
console.log("visible");
}
});

View file

@ -0,0 +1,26 @@
$(document).ready(() => {
// Close when clicking on *not* the modal-contents
window.onclick = (event) => {
if (event.target.classList.contains("modal")) {
$(event.target).slideUp(150);
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';
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.body.classList.add("no-scroll");
});
});
});

View file

@ -16,18 +16,18 @@
<script src="Libraries/js/jquery-3.4.1.min.js"></script>
<script src="Libraries/js/jquery-ui.min.js"></script>
<script src="Libraries/js/themekit/menu.js"></script>
<script src="Libraries/js/themekit/modal.js"></script>
<title>Juice-UI</title>
</head>
<body>
<div class="top titlebar">
<div class="mobile-menu">
<div class="close-mobile-menu" onclick='toggleMenu()'>
<i class="fa fa-close"></i>
</div>
<div class="compact item">
<div class="compact item" for-modal="aboutModal">
About
</div>
<div class="compact item">
@ -63,11 +63,11 @@
</div>
<div class="item">
<div class="item" for-modal="aboutModal">
<span>About&nbsp;<i class="fa fa-info"></i></span>
</div>
<a href="https://github.com/oitsjustjose/ThemeKit" target="_blank" class="item">
<span>GitHub&nbsp;<i class="fa fa-github"></i></span>
<span>GitHub&nbsp;<i class="fa fa-github"></i></span>
</a>
<div class="item">
Reddit
@ -270,6 +270,27 @@
</div>
<div id="aboutModal" class="modal">
<div class="modal-content">
<span class="close">
<i class="fa fa-close"></i>
</span>
<div class="container">
<h2>About This Page</h2>
<ul>
<li>
This page was written with mobile optimization first!
</li>
<li>
This ThemeKit is written from scratch with minimal JQuery (using DOM where possible)
</li>
<li>
This page not only shows you how these things work, but demo to me how they're turning out too!
</li>
</ul>
</div>
</div>
</div>
</body>