2023-06-20 13:17:21 +00:00
|
|
|
// FROM https://css-tricks.com/css-only-carousel/
|
|
|
|
|
|
|
|
@keyframes tonext {
|
|
|
|
75% {
|
|
|
|
left: 0;
|
|
|
|
}
|
|
|
|
95% {
|
|
|
|
left: 100%;
|
|
|
|
}
|
|
|
|
98% {
|
|
|
|
left: 100%;
|
|
|
|
}
|
|
|
|
99% {
|
|
|
|
left: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@keyframes tostart {
|
|
|
|
75% {
|
|
|
|
left: 0;
|
|
|
|
}
|
|
|
|
95% {
|
|
|
|
left: -300%;
|
|
|
|
}
|
|
|
|
98% {
|
|
|
|
left: -300%;
|
|
|
|
}
|
|
|
|
99% {
|
|
|
|
left: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@keyframes snap {
|
|
|
|
96% {
|
|
|
|
scroll-snap-align: center;
|
|
|
|
}
|
|
|
|
97% {
|
|
|
|
scroll-snap-align: none;
|
|
|
|
}
|
|
|
|
99% {
|
|
|
|
scroll-snap-align: none;
|
|
|
|
}
|
|
|
|
100% {
|
|
|
|
scroll-snap-align: center;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
* {
|
|
|
|
box-sizing: border-box;
|
|
|
|
scrollbar-color: transparent transparent; /* thumb and track color */
|
|
|
|
scrollbar-width: 0px;
|
|
|
|
}
|
|
|
|
|
|
|
|
*::-webkit-scrollbar {
|
|
|
|
width: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
*::-webkit-scrollbar-track {
|
|
|
|
background: transparent;
|
|
|
|
}
|
|
|
|
|
|
|
|
*::-webkit-scrollbar-thumb {
|
|
|
|
background: transparent;
|
|
|
|
border: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
* {
|
|
|
|
-ms-overflow-style: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
$height: 30rem;
|
|
|
|
|
|
|
|
.carousel {
|
|
|
|
ol, li {
|
|
|
|
list-style: none;
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
position: relative;
|
|
|
|
filter: drop-shadow(0 0 10px #0003);
|
|
|
|
perspective: 100px;
|
|
|
|
|
|
|
|
// define the height of the whole carousel
|
|
|
|
height: $height;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.carousel__viewport {
|
|
|
|
position: absolute;
|
2023-07-05 12:31:16 +00:00
|
|
|
z-index: 2;
|
2023-06-20 13:17:21 +00:00
|
|
|
top: 0;
|
|
|
|
right: 0;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
display: flex;
|
|
|
|
overflow-x: scroll;
|
|
|
|
counter-reset: item;
|
|
|
|
scroll-behavior: smooth;
|
|
|
|
scroll-snap-type: x mandatory;
|
|
|
|
}
|
|
|
|
|
|
|
|
.carousel__slide {
|
|
|
|
position: relative;
|
|
|
|
flex: 0 0 100%;
|
|
|
|
width: 100%;
|
|
|
|
counter-increment: item;
|
2024-01-11 07:32:38 +00:00
|
|
|
z-index: 1; // important: need to have a base set
|
2023-06-20 13:17:21 +00:00
|
|
|
}
|
|
|
|
|
2023-07-05 12:31:16 +00:00
|
|
|
.slide-content {
|
|
|
|
position: absolute;
|
|
|
|
width: 100%;
|
2024-01-11 07:32:38 +00:00
|
|
|
z-index: 0;
|
2023-07-05 12:31:16 +00:00
|
|
|
|
|
|
|
.slide-image {
|
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
2024-01-11 07:32:38 +00:00
|
|
|
img {
|
|
|
|
border-radius: 2px;
|
|
|
|
}
|
2023-07-05 12:31:16 +00:00
|
|
|
figcaption {
|
|
|
|
font-size: .9rem;
|
|
|
|
opacity: 0.9;
|
|
|
|
text-align: center;
|
2024-01-11 07:56:12 +00:00
|
|
|
margin-top: 1rem;
|
2023-07-05 12:31:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.slide-inner {
|
|
|
|
}
|
|
|
|
|
2023-06-23 21:19:30 +00:00
|
|
|
// .carousel__slide:nth-child(even) {
|
|
|
|
// background-color: #99f;
|
|
|
|
// }
|
2023-06-20 13:17:21 +00:00
|
|
|
|
|
|
|
.carousel__slide:before {
|
|
|
|
position: absolute;
|
|
|
|
top: 50%;
|
|
|
|
left: 50%;
|
|
|
|
transform: translate3d(-50%,-40%,70px);
|
|
|
|
color: #fff;
|
|
|
|
font-size: 2em;
|
|
|
|
}
|
|
|
|
|
|
|
|
.carousel__snapper {
|
2024-01-11 07:32:38 +00:00
|
|
|
position: sticky;
|
2023-06-20 13:17:21 +00:00
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
scroll-snap-align: center;
|
2024-01-11 07:32:38 +00:00
|
|
|
z-index: 2;
|
|
|
|
pointer-events: none; // let the slide content take the pointer events
|
2023-06-20 13:17:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// @media (hover: hover) {
|
|
|
|
// .carousel__snapper {
|
|
|
|
// animation-name: tonext, snap;
|
|
|
|
// animation-timing-function: ease;
|
|
|
|
// animation-duration: 4s;
|
|
|
|
// animation-iteration-count: infinite;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// .carousel__slide:last-child .carousel__snapper {
|
|
|
|
// animation-name: tostart, snap;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
@media (prefers-reduced-motion: reduce) {
|
|
|
|
.carousel__snapper {
|
|
|
|
animation-name: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.carousel:hover .carousel__snapper,
|
|
|
|
.carousel:focus-within .carousel__snapper {
|
|
|
|
animation-name: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.carousel__navigation {
|
|
|
|
position: absolute;
|
2023-07-05 12:31:16 +00:00
|
|
|
z-index: 2;
|
2023-06-20 13:17:21 +00:00
|
|
|
right: 0;
|
2023-06-23 21:19:30 +00:00
|
|
|
bottom: 1rem;
|
2023-06-20 13:17:21 +00:00
|
|
|
left: 0;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.carousel__navigation-list,
|
|
|
|
.carousel__navigation-item {
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.carousel__navigation-button {
|
|
|
|
display: inline-block;
|
|
|
|
width: 1.5rem;
|
|
|
|
height: 1.5rem;
|
|
|
|
background-clip: content-box;
|
2023-07-05 12:31:16 +00:00
|
|
|
background-color: #eeeeee;
|
|
|
|
box-shadow: inset 0 0 2px black;
|
2023-06-20 13:17:21 +00:00
|
|
|
border: 0.25rem solid transparent;
|
|
|
|
border-radius: 50%;
|
|
|
|
font-size: 0;
|
|
|
|
transition: transform 0.1s;
|
|
|
|
}
|
|
|
|
|
|
|
|
.carousel::before,
|
|
|
|
.carousel::after,
|
|
|
|
.carousel__prev,
|
|
|
|
.carousel__next {
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
width: 4rem;
|
|
|
|
height: 4rem;
|
|
|
|
transform: translateY($height/2 - 2rem);
|
|
|
|
border-radius: 50%;
|
|
|
|
font-size: 0;
|
|
|
|
outline: 0;
|
2024-01-11 07:32:38 +00:00
|
|
|
z-index: 2;
|
2023-06-20 13:17:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.carousel::before,
|
|
|
|
.carousel__prev {
|
2023-07-05 12:31:16 +00:00
|
|
|
left: -0.5rem;
|
2023-06-20 13:17:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.carousel::after,
|
|
|
|
.carousel__next {
|
2023-07-05 12:31:16 +00:00
|
|
|
right: -0.5rem;
|
2023-06-20 13:17:21 +00:00
|
|
|
}
|
|
|
|
|
2024-01-11 07:32:38 +00:00
|
|
|
.carousel__prev,.carousel__next {
|
|
|
|
// make sure that the square on each side is can be interacted with
|
|
|
|
pointer-events: visible !important;
|
|
|
|
}
|
|
|
|
|
2023-07-05 12:31:16 +00:00
|
|
|
// the big circle navigation button left and right
|
2023-06-20 13:17:21 +00:00
|
|
|
.carousel::before,
|
|
|
|
.carousel::after {
|
|
|
|
content: '';
|
2024-01-11 07:32:38 +00:00
|
|
|
z-index: 10;
|
2023-07-05 12:31:16 +00:00
|
|
|
background-color: transparent;
|
|
|
|
opacity: 0.65;
|
2023-06-20 13:17:21 +00:00
|
|
|
background-size: 1.5rem 1.5rem;
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
background-position: center center;
|
|
|
|
font-size: 2.5rem;
|
|
|
|
line-height: 4rem;
|
|
|
|
text-align: center;
|
|
|
|
pointer-events: none;
|
|
|
|
}
|
|
|
|
|
2023-07-05 12:31:16 +00:00
|
|
|
.carousel::before:hover, .carousel::after:hover {
|
|
|
|
opacity: 1 !important;
|
|
|
|
}
|
|
|
|
|
2023-06-20 13:17:21 +00:00
|
|
|
.carousel::before {
|
2023-07-05 12:31:16 +00:00
|
|
|
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolygon points='0,50 80,100 80,0' /%3E%3C/svg%3E");
|
2023-06-20 13:17:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.carousel::after {
|
2023-07-05 12:31:16 +00:00
|
|
|
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolygon points='100,50 20,100 20,0' /%3E%3C/svg%3E");
|
2023-06-20 13:17:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.carousel__navigation-item {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.carousel__navigation-item.enabled {
|
|
|
|
.carousel__navigation-button {
|
|
|
|
opacity: 0.5;
|
2023-07-05 12:31:16 +00:00
|
|
|
background-color: lighten($accent, 0%);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@media (max-width: $md-breakpoint) {
|
2024-01-11 07:56:12 +00:00
|
|
|
$md-height: 47rem;
|
2023-07-05 12:31:16 +00:00
|
|
|
.carousel {
|
|
|
|
height: $md-height !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.carousel::before,
|
|
|
|
.carousel::after,
|
|
|
|
.carousel__prev,
|
|
|
|
.carousel__next {
|
2024-01-11 07:56:12 +00:00
|
|
|
transform: translateY($md-height - 4.5rem) !important;
|
2023-07-05 12:31:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.carousel::next {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// layout definitions inside the slides
|
|
|
|
.layout-grid-image {
|
|
|
|
display: grid;
|
|
|
|
grid-column-gap: 2rem;
|
|
|
|
|
|
|
|
|
|
|
|
.image-container {
|
2024-01-11 07:32:38 +00:00
|
|
|
margin-top: 1.5rem;
|
2023-07-05 12:31:16 +00:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.double-image-container {
|
|
|
|
display: flex;
|
|
|
|
}
|
|
|
|
|
|
|
|
.layout-grid-image.third {
|
|
|
|
grid-template-columns: 3fr 1fr;
|
|
|
|
}
|
|
|
|
|
|
|
|
.layout-grid-image.half {
|
|
|
|
grid-template-columns: 1fr 1fr;
|
|
|
|
}
|
|
|
|
|
|
|
|
@media (max-width: $md-breakpoint) {
|
|
|
|
.carousel {
|
|
|
|
.layout-grid-image.half {
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
|
|
|
.layout-grid-image.third {
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
|
|
|
.image-container {
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
2024-01-11 07:56:12 +00:00
|
|
|
padding-top: 1rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.slide-content {
|
|
|
|
.page-container {
|
|
|
|
padding: 0 1.5rem;
|
|
|
|
}
|
2023-07-05 12:31:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.slide-image {
|
2024-01-11 07:56:12 +00:00
|
|
|
height: 20rem;
|
2023-07-05 12:31:16 +00:00
|
|
|
img {
|
|
|
|
width: auto;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
}
|
2023-06-20 13:17:21 +00:00
|
|
|
}
|
|
|
|
}
|
2024-01-11 07:56:12 +00:00
|
|
|
|
|
|
|
@media (max-width: $sm-breakpoint) {
|
|
|
|
.carousel {
|
|
|
|
.image-container {
|
|
|
|
padding-top: 0rem;
|
|
|
|
}
|
|
|
|
.slide-image {
|
2024-02-26 12:01:42 +00:00
|
|
|
height: 16rem;
|
2024-01-11 07:56:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|