diff --git a/src/patterns/04-components/facts-and-figures/facts-and-figures.js b/src/patterns/04-components/facts-and-figures/facts-and-figures.js index c821490b5b8faf9c6f3b6d9cc2d884bfaccc0fb0..2a787640788deda1355137f0a585a113f309dc1b 100644 --- a/src/patterns/04-components/facts-and-figures/facts-and-figures.js +++ b/src/patterns/04-components/facts-and-figures/facts-and-figures.js @@ -15,14 +15,11 @@ */ function runCarousel(id, numOfItems) { var $carousel = $(id + ' .carousel', context); - if ($carousel.length) { $carousel.flickity({ - cellAlign: 'left', - contain: true, pageDots: true, prevNextButtons: false, - wrapAround: true, + wrapAround: false, groupCells: function () { var width = $(window).width(); if (width <= 600) { @@ -68,11 +65,14 @@ }); }); // previous button - $('.uw-button--previous').on( 'click', function () { + $('.uw-button--previous').on('click', function () { + var $carousel = $(this).closest('.uw-ff').find('.carousel'); $carousel.flickity('previous'); }); - // next - $('.uw-button--next').on( 'click', function () { + + // next button + $('.uw-button--next').on('click', function () { + var $carousel = $(this).closest('.uw-ff').find('.carousel'); $carousel.flickity('next'); }); }