Can't have more than one flickity carousel on a page

Created on 29 October 2016, about 8 years ago
Updated 6 December 2018, almost 6 years ago

I have one Flickity carousel on a page. Further down the page I need another but the 2nd carousel is completely broken. The content of the view appears but it's not a Flickity carousel.

I required at least 3 carousels on the home page.

🐛 Bug report
Status

Active

Version

2.2

Component

Miscellaneous

Created by

🇬🇧United Kingdom zincdesign

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇬🇷Greece alexpertsi

    Use this javascript code

    if(document.querySelector('.name-field-smedia')){
        let sliders = document.querySelectorAll('.name-field-smedia');
        for (var i = 0; i < sliders.length; i++) {
          let slider = new Flickity(sliders[i], {
            wrapAround: true,
            pageDots: false,
            imagesLoaded: true
          });
        }
     }
    
Production build 0.71.5 2024