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