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
No related merge requests found
......@@ -8,6 +8,16 @@ $size-medium: 4;
$size-large: 4;
$size-xlarge: 7;
.uw-ig {
.uw-button--wrap {
display:none;
margin-top: var(--size-6);
&.active {
display: flex;
}
}
.flickity-page-dots {
bottom: -2rem;
}
&--slider {
//
}
......@@ -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
......
......@@ -144,4 +144,10 @@
{% endfor %}
{% endif %}
</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>
......@@ -19,40 +19,38 @@
var imagesNum = $(this).data('images-num') || 1;
var navStyle = $(this).data('nav') || 'both';
// Create owl carouse config first.
var carousel = {
loop: true,
dots: true,
nav: true,
navContainerClass: 'uw-owl-nav',
navText:[
'prev',
'next'
],
margin: 10,
responsiveClass: true,
responsive: {
0: {
items: 1
},
600: {
items: imagesNum
},
1000: {
items: imagesNum
}
}
// Create carousel config first.
var flickityOptions = {
cellAlign: 'left',
contain: true,
wrapAround: true,
draggable: false,
groupCells: function () {
var width = $(window).width();
return width <= 600 ? 1 : imagesNum;
},
prevNextButtons: false,
pageDots: navStyle === 'pagination' || navStyle === 'both'
};
if (navStyle === 'pagination') {
carousel.nav = false;
}
else if (navStyle === 'navigation') {
carousel.dots = false;
var $carousel = $(id + ' .carousel');
if ($carousel.length) {
$carousel.flickity(flickityOptions);
}
// 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.
$(id + ' .owl-carousel').owlCarousel(carousel);
if (navStyle === 'navigation' || navStyle === 'both') {
$('.uw-button--wrap').addClass('active');
}
// Lightbox enchancements
$('.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