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

ISTWCMS-5650: Swap out owl and Add the flickity to the javascript

parent 0dde3746
No related branches found
No related tags found
1 merge request!273Feature/istwcms 5650 m26lebla owl carousel replacement
......@@ -5,7 +5,7 @@
(function ($, Drupal) {
'use strict';
Drupal.behaviors.factfigure = {
attach: function () {
attach: function (context) {
/**
* Run the carousel.
......@@ -14,31 +14,29 @@
* @return {null} void
*/
function runCarousel(id, numOfItems) {
// Add the carousel to the FF using the id.
$(id + ' .owl-carousel').owlCarousel({
margin: 10,
nav: true,
navContainerClass: 'uw-owl-nav',
navText: [
'‹ prev',
'next ›'
],
responsiveClass: true,
responsive: {
0: {
items: 1
},
600: {
items: numOfItems <= 2
? (numOfItems - 1 > 0)
? numOfItems - 1 : 1 : 2
},
1000: {
items: numOfItems
var $carousel = $(id + ' .carousel', context);
if ($carousel.length) {
$carousel.flickity({
cellAlign: 'left',
contain: true,
pageDots: false,
prevNextButtons: true,
wrapAround: true,
groupCells: function () {
var width = $(window).width();
if (width <= 600) {
return 1;
}
else if (width <= 1024) {
return Math.min(2, numOfItems);
}
else {
return numOfItems;
}
}
}
});
});
}
}
/**
......
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