rework CSS and JS

This commit is contained in:
2024-01-30 22:47:35 +01:00
parent 8e426a6611
commit 4b5fe07ece
3 changed files with 169 additions and 135 deletions

View File

@@ -18,123 +18,170 @@
}
}
/* The Modal (background) */
.modal {
.snap-lightbox {
/** Default lightbox to hidden */
display: none;
/** Position and style */
position: fixed;
z-index: 1;
padding-top: 50px;
//padding-bottom: 10%;
left: 0;
top: 0;
z-index: 999;
width: 100%;
height: 100%;;
overflow: auto;
background-color: black;
height: 100%;
text-align: center;
white-space: nowrap;
top: 0;
left: 0;
background: rgba(0, 0, 0, 0.8);
/* keep lightbox in middle. TODO: hacky, and not realibly in middle */
&:before {
content: "";
display: inline-block;
vertical-align: middle;
width: 0;
/* adjust for white space between pseudo element and next sibling */
margin-right: -.25em;
/* stretch line height */
height: 100%;
}
}
/* Modal Content */
.modal-content {
position: relative;
background-color: #fefefe;
margin: auto;
padding: 0;
width: 90%;
max-width: 1200px;
height: calc(100% - 100px);
}
// /* Click on the complete background closes the lightbox */
// /* Exception: arrow in gallery, they have higher z-index */
// a.snap-lightbox-close {
// position: fixed;
// z-index: 800;
// width: 100%;
// height: 100%;
// text-align: center;
// white-space: nowrap;
// top: 0;
// left: 0;
// }
/* The Close Button */
.close {
color: white;
position: absolute;
top: 10px;
right: 25px;
font-size: 35px;
font-weight: bold;
}
/* Container for image */
.snap-lightbox-inner {
display: inline-block;
vertical-align: middle;
white-space: normal;
max-width: 90%;
max-height: 80%;
height: 100%;
.close:hover,
.close:focus {
color: #999;
text-decoration: none;
cursor: pointer;
}
/* Hide the slides by default */
.snap-slide {
display: none;
max-height: 100%;
/* Number text (1/3 etc) */
.numbertext {
color: #f2f2f2;
background-color: #000;
font-size: 12px;
padding: 8px 12px;
position: absolute;
top: 10%;
}
img {
max-height: 100%;
}
// TODO: Untested
p {
color: #fff;
z-index: 810;
position: relative;
}
}
/* Next & previous buttons */
.prev,
.next {
cursor: pointer;
position: absolute;
top: 50%;
width: auto;
padding: 16px;
margin-top: -50px;
color: white;
font-weight: bold;
font-size: 20px;
transition: 0.6s ease;
border-radius: 0 3px 3px 0;
user-select: none;
-webkit-user-select: none;
text-decoration: none !important;
}
// /* Caption text */
// .caption-container {
// text-align: center;
// background-color: black;
// padding: 2px 16px;
// color: white;
// }
/* Position the "next button" to the right */
.next {
right: 0;
border-radius: 3px 0 0 3px;
}
/* On hover, add a black background color with a little bit see-through */
.prev:hover,
.next:hover {
background-color: rgba(0, 0, 0, 0.8);
}
/* Number text (1/3 etc) */
.numbertext {
color: #f2f2f2;
background-color: #000;
font-size: 12px;
padding: 8px 12px;
position: absolute;
top: 0;
}
/* Caption text */
.caption-container {
/* prev/next arrows & close button */
.snap-lightbox-prev,
.snap-lightbox-next {
position: fixed;
z-index: 800;
width: 5%;
height: 100%;
text-align: center;
background-color: black;
padding: 2px 16px;
top: 0;
.snap-lightbox-arrow {
display: inline-block;
position: fixed;
top: 50%;
z-index: 900;
border: solid #fff;
border-width: 0 7px 7px 0;
display: inline-block;
padding: 1%;
}
&:hover>.snap-lightbox-arrow {
border-color: #999;
transition: all 0.25s ease;
}
}
.snap-lightbox-prev {
left: 0;
.snap-lightbox-arrow {
left: 2%;
transform: rotate(135deg);
-webkit-transform: rotate(135deg);
}
}
.snap-lightbox-next {
right: 0;
.snap-lightbox-arrow {
right: 2%;
transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
}
}
/* The Close Button */
.snap-close {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 15px;
right: 15px;
height: 50px;
width: 50px;
color: white;
font-size: 50px;
font-weight: bold;
z-index: 900;
&:hover,
&:focus {
color: #999;
text-decoration: none;
cursor: pointer;
}
}
img.img-thumb {
opacity: 0.6;
}
@media screen and (max-width: 767px) {
.snap-lightbox-inner {
max-width: 80%;
}
.img-active,
.img-thumb:hover {
opacity: 1 !important;
}
.snap-lightbox-prev,
.snap-lightbox-next {
width: 10%;
}
img.hover-shadow {
transition: 0.3s;
}
.hover-shadow:hover {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
.snap-lightbox-close-button {
width: 10%;
height: calc(10vw);
/* ~10% width */
}
}