improve prev/next buttons

This commit is contained in:
2024-02-01 23:12:08 +01:00
parent 69fe2580b0
commit 132828389b
3 changed files with 64 additions and 55 deletions

View File

@@ -2,11 +2,15 @@ $gap: var(--gap);
.snap-gallery,
.snap-slideshow {
display: flex;
justify-content: center;
align-items: center;
position: relative;
margin-bottom: $gap;
/* Create equal columns in flexbox */
.snap-image {
cursor: pointer;
cursor: zoom-in;
/* Column amount and width are configurable by style variables */
width: calc(100% / var(--columns) - #{$gap});
@@ -21,9 +25,7 @@ $gap: var(--gap);
}
.snap-gallery {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: $gap;
}
@@ -96,11 +98,17 @@ $gap: var(--gap);
z-index: 810;
position: relative;
}
@media screen and (max-width: 767px) {
max-width: 80%;
}
}
/* Number text (1/3 etc) */
.snap-lightbox,
.snap-slideshow {
user-select: none;
.numbertext {
color: #f2f2f2;
background-color: #000;
@@ -119,50 +127,68 @@ $gap: var(--gap);
// }
/* prev/next arrows & close button */
.snap-lightbox-prev,
.snap-lightbox-next {
position: fixed;
.snap-prev,
.snap-next {
color: #fff;
text-decoration: none !important;
font-size: 30px;
position: absolute;
height: 100%;
z-index: 800;
width: 5%;
height: 100%;
text-align: center;
top: 0;
cursor: pointer;
.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;
// Slideshow specifics
.snap-slideshow & {
display: flex;
justify-content: center;
align-items: center;
background-color: rgba(0, 0, 0, 0.7);
height: 15%;
width: 10%;
min-height: 50px;
min-width: 50px;
&:hover {
background-color: rgba(0, 0, 0, 0.8);
transition: all 0.25s ease;
}
}
// Lightbox-specifics
.snap-lightbox & {
@media screen and (max-width: 767px) {
width: 10%;
}
}
// Item containing arrow
span {
padding: 1%;
}
&:hover>.snap-lightbox-arrow {
border-color: #999;
transition: all 0.25s ease;
// Lightbox specifics
.snap-lightbox & {
position: fixed;
top: 50%;
}
}
}
.snap-lightbox-prev {
// Position arrows for left/right
.snap-prev {
left: 0;
.snap-lightbox-arrow {
left: 2%;
transform: rotate(135deg);
-webkit-transform: rotate(135deg);
.snap-lightbox & span {
left: 0.5%;
}
}
.snap-lightbox-next {
.snap-next {
right: 0;
.snap-lightbox-arrow {
right: 2%;
transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
.snap-lightbox & span {
right: 0.5%;
}
}
@@ -188,20 +214,3 @@ $gap: var(--gap);
cursor: pointer;
}
}
@media screen and (max-width: 767px) {
.snap-lightbox-inner {
max-width: 80%;
}
.snap-lightbox-prev,
.snap-lightbox-next {
width: 10%;
}
.snap-lightbox-close-button {
width: 10%;
height: calc(10vw);
/* ~10% width */
}
}