Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#1314·flickity

WrapAround is not working as expected, When on first slide the last adjacent slide flickers and similarly happens on the last slide.

Author: rajatjyotishiCreated Dec 9, 2024Updated Dec 9, 2024

The wrapAround property in Flickity is not functioning as expected. When enabled, the carousel should seamlessly loop back to the beginning when reaching the end of the slides. However, in my implementation, the slides do not wrap around correctly, and the carousel stops at the last slide.

Steps to Reproduce

  1. Initialize a Flickity carousel with the wrapAround option set to true.
  2. Add multiple slides to the carousel.
  3. Attempt to navigate through the slides to observe the wrap-around behavior.

Expected Behavior The carousel should loop back to the first slide after reaching the last slide, creating a seamless wrap-around effect.

Actual Behavior When on first slide the last adjacent slide flickers and similarly when on last slide the adjacent first slides flickers.

const carouselElement = el.querySelector(`.${CAROUSEL_CLASS_NAME}`);
const flickity = new Flickity(carouselElement, {
          wrapAround: true,
          imagesLoaded: true,
          accessibility: true,
          adaptiveHeight: true,
          autoPlay: Number(el.dataset.speed) || false,
          pageDots: el.dataset.slideDots === 'true',
          prevNextButtons: el.dataset.prevNextButtons === 'true',
          lazyLoad: true,
        });
  • Flickity version: ^2.3.0 Using this with apostrophe, version 4.8.1.

Please let me know if you need any further information or if there are any workarounds for this issue.

Source: metafizzy/flickity

View original on GitHubView discussion on GitHub