<section class="c-carousel c-carousel--gallery" aria-hidden="true">
<div class="jsInstance owl-carousel">
<div style="background-image: url(https://picsum.photos/560/360)" class="c-carousel__background-image" alt=""></div>
<div style="background-image: url(https://picsum.photos/560/360)" class="c-carousel__background-image" alt=""></div>
<div style="background-image: url(https://picsum.photos/560/360)" class="c-carousel__background-image" alt=""></div>
<div style="background-image: url(https://picsum.photos/560/360)" class="c-carousel__background-image" alt=""></div>
</div>
</section>
<section class="c-carousel {{ modifier }}" aria-hidden="true">
<div class="jsInstance owl-carousel">
{{#if images}}
{{#each images}}
<div style="background-image: url({{ this.img-path }})" class="c-carousel__background-image" alt=""></div>
{{/each}}
{{else}}
{{#each items}}
<div class="c-carousel__item">
{{ render componentName componentInstance merge=true }}
</div>
{{/each}}
{{/if}}
</div>
</section>
{
"aria-label-title": "Parcheggi disponibili",
"items": [
{
"componentName": "@product--carousel",
"componentInstance": {
"modifier": "c-product--carousel c-product--p1-p2"
}
},
{
"componentName": "@product--carousel",
"componentInstance": {
"modifier": "c-product--carousel c-product--p1-p2"
}
},
{
"componentName": "@product--carousel",
"componentInstance": {
"modifier": "c-product--carousel c-product--p1-p2"
}
},
{
"componentName": "@product--carousel",
"componentInstance": {
"modifier": "c-product--carousel c-product--p1-p2"
}
},
{
"componentName": "@product--carousel",
"componentInstance": {
"modifier": "c-product--carousel c-product--p1-p2"
}
}
],
"modifier": "c-carousel--gallery",
"images": [
{
"img-path": "https://picsum.photos/560/360"
},
{
"img-path": "https://picsum.photos/560/360"
},
{
"img-path": "https://picsum.photos/560/360"
},
{
"img-path": "https://picsum.photos/560/360"
}
]
}
@use "sass:math";
$carouselNavBtnWidth: 44px;
.c-carousel {
padding-bottom: remify(44px);
position: relative;
z-index: $zIndex-carousel;
main & {
grid-column: main;
}
main &.c-carousel--fullwidth {
grid-column: full;
}
.l-travel-home__banner &,
.c-starting-grid &,
.c-pill &,
&.c-carousel--destinations {
padding-bottom: 0;
}
.c-main--flights-destination & {
z-index: $z-Index-carousel-destination-page;
}
}
.c-carousel__nav {
width: 100%;
position: relative;
z-index: 2;
margin-top: remify(24px);
@include min-screen( remify($base-page-width) ) {
top: 30%;
transform: translateY(-50%);
margin-top: 0;
position: absolute;
}
.prev-btn,
.next-btn {
cursor: pointer;
background: none;
-webkit-appearance: none;
border: none;
padding: 0;
position: absolute;
width: remify($carouselNavBtnWidth);
&.disabled {
display: none;
}
img {
height: 100%; // For IE11
}
}
.prev-btn {
left: 0;
// The code below creates horizontal scrollbars. So please consider that before using it
@include min-screen( remify($base-page-width) ) {
left: remify( - math.div($carouselNavBtnWidth, 2) );
}
}
.next-btn {
right: 0;
// The code below creates horizontal scrollbars. So please consider that before using it
@include min-screen( remify($base-page-width) ) {
right: remify( - math.div($carouselNavBtnWidth, 2) );
}
.c-utils--flight & {
@include min-screen( remify($base-page-width) ) {
right: remify(-13px);
}
}
}
}
.c-carousel__dots {
text-align: center;
position: relative;
z-index: 1;
top: remify(16px);
margin-top: remify(24px);
margin-left: auto;
margin-right: auto;
max-width: calc(100% - (#{$carouselNavBtnWidth} * 2) ); //fallback
max-width: fit-content;
}
.c-carousel__dot {
span {
width: remify(16px);
height: remify(16px);
margin: remify(4px) remify(8px);
background: primary(sky, 40);
display: block;
transition: opacity .3s ease;
border-radius: remify(30px);
}
.c-carousel__dots.disabled & {
display: none;
}
}
.c-carousel__dot.active {
span {
background: primary(sky, 120);
}
}
.c-carousel__footer-txt {
margin-top: remify(24px);
text-align: center;
}
/*------------------------------------*\
Padded modifier
\*------------------------------------*/
.c-carousel--padded {
.c-carousel__outer {
padding: remify(16px) 0;
}
}
/*------------------------------------*\
Equal Height modifier
\*------------------------------------*/
.c-carousel--equalH {
.c-carousel__stage {
display: flex;
}
.c-carousel__item {
height: 100%;
display: flex;
flex-direction: column;
}
}
.owl-stage {
.c-carousel__item {
padding-bottom: remify(24px);
}
}
/*------------------------------------*\
Gallery modifier
\*------------------------------------*/
.c-carousel--gallery {
.c-deck &,
.c-youfirst & {
padding-bottom: 0;
}
.c-pill & {
padding-bottom: 0;
margin-bottom: remify(-20px);
}
.c-carousel__dots {
// background-color: rgba(243, 243, 243, 0.3);
// border-radius: remify(4px);
margin-top: 0;
top: remify(-56px);
display: flex;
align-items: center;
justify-content: center;
span {
background-color: primary(sky, 20);
box-shadow: 0 0 10px rgba(0, 0, 0, .35);
}
.c-starting-grid & {
@include min-screen(bp(phablet)) {
top: remify(-80px);
}
}
}
.c-carousel__dot.active {
span {
background-color: primary(sun, 120);
}
}
.c-content-expo__item & {
padding-bottom: 0;
}
img {
.c-snapshot--gallery & {
width: remify(270px);
height: remify(205px);
}
.c-content-expo__item & {
margin-bottom: 0;
}
}
}
/*------------------------------------*\
Gallery dot text modifier
\*------------------------------------*/
.c-carousel--dot-text {
.c-carousel__dots {
@include min-screen(bp(tablet)) {
top: 0;
max-width: 100%;
margin: 0;
display: flex;
}
}
.c-carousel__dot {
@include min-screen(bp(tablet)) {
flex: 1;
}
button {
@include min-screen(bp(tablet)) {
color: primary(night, 100);
width: 100%;
background: none;
border: none;
cursor: pointer;
padding-top: remify(18px);
}
}
}
.c-carousel__dot.active {
position: relative;
button {
@include min-screen(bp(tablet)) {
color: primary(sky, 120);
}
}
&:before {
@include min-screen(bp(tablet)) {
content: '';
border-radius: 0;
position: absolute;
width: 100%;
height: remify(8px);
background-color: primary(sky, 120);
top: 0;
left: 0;
}
}
}
}
/*------------------------------------*\
Only desktop modifier
\*------------------------------------*/
.c-carousel--phoneHidden {
@include max-screen(bp(tablet-l)) {
display: none;
}
}
/*------------------------------------*\
Big gallery modifier
\*------------------------------------*/
.c-carousel--big-gallery {
padding-bottom: 0;
.c-carousel__nav {
top: 45%;
position: absolute;
margin-top: 0;
}
.img-desc {
color: secondary(basic-white, 100);
text-align: center;
margin-top: remify(8px);
}
.c-carousel__counter {
@include font-scale(level-2, semibold);
text-align: center;
color: secondary(basic-white, 100);
position: absolute;
top: remify(12px);
right: remify(110px);
@include max-screen(bp(tablet-p)) {
top: 61px;
}
}
.c-carousel__item img {
margin-inline: auto;
@include shadow(small);
}
}
.c-carousel--zeroIndex {
// To avoid that .c-snapshot--gallery remains visible when the big gallery is open
z-index: 0;
}
/*------------------------------------*\
Shops modifier
\*------------------------------------*/
.c-carousel--shops {
.c-carousel__item {
height: 100%;
}
}
/*------------------------------------*\
Background image modifier
\*------------------------------------*/
.c-carousel__background-image {
height: 350px;
background-repeat: no-repeat;
background-size: cover;
background-position: center;
}
/*------------------------------------*\
ZOOM modifier
\*------------------------------------*/
.c-carousel--zoom {
.owl-stage {
display: flex;
align-items: center;
padding-bottom: remify(40px);
}
.owl-item {
// transition: all .3s ease;
}
.owl-item.active.center {
@include min-screen(bp(phablet)) {
zoom: 1.22;
transition: zoom .2s ease;
}
}
.c-carousel__dots {
top: remify(-40px);
}
}
/*------------------------------------*\
ZOverflowOOM modifier
\*------------------------------------*/
.c-carousel--overflow {
.owl-stage {
display: flex;
align-items: center;
padding-bottom: remify(40px);
}
.c-carousel__dots {
top: remify(-40px);
}
}
/*------------------------------------*
Mobile mockups carousel
*------------------------------------*/
.c-carousel--mobile-mockups {
.owl-item.active.center img {
box-shadow: none;
filter: drop-shadow(-30px 20px 30px rgba(6, 20, 32, 0.38));
}
}
/*------------------------------------*
Modifier: Flight fares
*------------------------------------*/
.c-carousel--flight-fares {
.owl-carousel .owl-stage {
display: flex;
}
.owl-stage .c-carousel__item {
height: 100%;
}
.c-fare {
height: 100%;
}
}
/*------------------------------------*
Modifier: Top nav
*------------------------------------*/
.c-carousel--top-nav {
.c-carousel__outer {
padding-top: remify(80px);
}
.c-carousel__nav {
position: absolute;
top: 0;
margin-top: 0;
left: 0;
transform: initial;
display: flex;
justify-content: flex-end;
gap: remify(8px);
@include max-screen(bp(tablet-p)) {
top: 50px;
}
.prev-btn, .next-btn {
position: relative;
&.disabled {
display: inline-block;
cursor: not-allowed;
opacity: .45;
}
}
.prev-btn {
left: 0;
}
.next-btn {
right: 0;
}
}
}
/*------------------------------------*\
Auto height 100%
\*------------------------------------*/
.c-carousel--autoHeight {
height: 100%;
.owl-carousel,
.owl-carousel .owl-stage-outer,
.owl-carousel .owl-stage,
.owl-carousel.owl-drag .owl-item,
.owl-stage .c-carousel__item {
height: 100% !important;
}
.owl-carousel .owl-item img {
height: 100%;
object-fit: contain;
box-shadow: none;
padding-bottom: remify(8px);
}
.img-desc {
margin-top: 0;
}
}
(function($) {
var $carouselItem = $('.c-carousel__item');
var $dialogIntoCarousel = $carouselItem.find( $('.c-dialog') );
// Moves the dialog that lives into the carousel before </body>,
// otherwise the dialog opens into carousel item in a wrong way
$dialogIntoCarousel.appendTo('body');
})(jQuery);
To set the same height to all the elements of the carousel, you have to add this CSS modifier to root element: c-carousel--equalH
and also this JS option into plugin initialization: stageClass: "owl-stage c-carousel__stage"