Skip to content
Snippets Groups Projects
Commit 2fc1c8f0 authored by Martin Leblanc's avatar Martin Leblanc Committed by Kevin Paxman
Browse files

ISTWCMS-5650: Replace the image gallery owl carousel with flickity libraries

parent 08be5eb7
No related branches found
No related tags found
1 merge request!273Feature/istwcms 5650 m26lebla owl carousel replacement
...@@ -8,6 +8,16 @@ $size-medium: 4; ...@@ -8,6 +8,16 @@ $size-medium: 4;
$size-large: 4; $size-large: 4;
$size-xlarge: 7; $size-xlarge: 7;
.uw-ig { .uw-ig {
.uw-button--wrap {
display:none;
margin-top: var(--size-6);
&.active {
display: flex;
}
}
.flickity-page-dots {
bottom: -2rem;
}
&--slider { &--slider {
// //
} }
...@@ -196,6 +206,36 @@ $size-xlarge: 7; ...@@ -196,6 +206,36 @@ $size-xlarge: 7;
} }
} }
} }
&[data-images-num="1"],
&[data-images-num="2"],
&[data-images-num="3"],
&[data-images-num="4"] {
.uw-ig__item {
margin-left: var(--size-1);
width: 100%;
&:first-child {
margin-left: inherit;
}
}
}
@media(min-width: $screen-md) {
&[data-images-num="2"] {
.uw-ig__item {
max-width: 45%;
}
}
&[data-images-num="3"] {
.uw-ig__item {
max-width: 32%;
}
}
&[data-images-num="4"] {
.uw-ig__item {
max-width: 24.5%;
}
}
}
} }
// //
// lightbox // lightbox
......
...@@ -144,4 +144,10 @@ ...@@ -144,4 +144,10 @@
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</div> </div>
{% if type == NULL or type == 'slider' %}
<div class="uw-button--wrap">
<button class="uw-ig-button--previous"> < Prev</button>
<button class="uw-ig-button--next">Next ></button>
</div>
{% endif %}
</div> </div>
...@@ -19,40 +19,38 @@ ...@@ -19,40 +19,38 @@
var imagesNum = $(this).data('images-num') || 1; var imagesNum = $(this).data('images-num') || 1;
var navStyle = $(this).data('nav') || 'both'; var navStyle = $(this).data('nav') || 'both';
// Create owl carouse config first. // Create carousel config first.
var carousel = { var flickityOptions = {
loop: true, cellAlign: 'left',
dots: true, contain: true,
nav: true, wrapAround: true,
navContainerClass: 'uw-owl-nav', draggable: false,
navText:[ groupCells: function () {
'prev', var width = $(window).width();
'next' return width <= 600 ? 1 : imagesNum;
], },
margin: 10, prevNextButtons: false,
responsiveClass: true, pageDots: navStyle === 'pagination' || navStyle === 'both'
responsive: {
0: {
items: 1
},
600: {
items: imagesNum
},
1000: {
items: imagesNum
}
}
}; };
if (navStyle === 'pagination') { var $carousel = $(id + ' .carousel');
carousel.nav = false;
} if ($carousel.length) {
else if (navStyle === 'navigation') { $carousel.flickity(flickityOptions);
carousel.dots = false;
} }
// previous button
$('.uw-ig-button--previous').on( 'click', function() {
$carousel.flickity('previous');
});
// next
$('.uw-ig-button--next').on( 'click', function() {
$carousel.flickity('next');
});
// Add the carousel to the FF using the id. if (navStyle === 'navigation' || navStyle === 'both') {
$(id + ' .owl-carousel').owlCarousel(carousel); $('.uw-button--wrap').addClass('active');
}
// Lightbox enchancements // Lightbox enchancements
$('.uw-lightbox__open').on('click', function () { $('.uw-lightbox__open').on('click', function () {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment