From 9f22be098ce0230c5dc82ac190f441cb345e41d5 Mon Sep 17 00:00:00 2001 From: Martin Leblanc <m26lebla@uwaterloo.ca> Date: Thu, 13 Mar 2025 13:13:42 -0400 Subject: [PATCH] ISTWCMS-5650: Add previous next button scope per carousel --- .../facts-and-figures/facts-and-figures.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 c821490b..2a787640 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'); }); } -- GitLab