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

Created on 29 October 2016, over 7 years ago
Updated 6 December 2018, over 5 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.69.0 2024