flickity-sync icon indicating copy to clipboard operation
flickity-sync copied to clipboard

Sync on nav slide click

Open htmagedev opened this issue 8 years ago • 2 comments

Hello,

Flickity sync is the perfect solution for showing synchronized sliders. In our case it's used as a product image gallery: 1 big image in top slider and thumbnails in navigation slider beneath.

However, there is one thing missing: screen recordings of real user visits shows us that users frequently click on the navigation slides to get a bigger image in the top slider. But that does not work with flickity sync. We also tried as-nav-for which can do that but then sliders are not fully synced. Is it possible to get best of both worlds?

htmagedev avatar Jul 12 '17 11:07 htmagedev

Thanks for reporting this issue. You should be able to add some JS to resolve this

// jQuery
$navCarousel.on( 'staticClick.flickity', function( event, pointer, cellElement, cellIndex ) {
  if ( cellElement ) {
    $mainCarousel.flickity( 'select', cellIndex );
  }
});
// vanilla JS
navFlkty.on( 'staticClick', function( event, pointer, cellElement, cellIndex ) {
  mainFlkty.select( cellIndex );
});

desandro avatar Jul 12 '17 14:07 desandro

Yes! perfect, that's working great. Thanks.

The next ideas I have to make it a perfect product images gallery is:

  1. To always fit both sliders into the viewport of the browser. That would make a good UX on all devices, especially mobile devices.
  2. To have a "full-screen" button on the main carousel to get the main carousel full screen, images centered and with caption (that would replace lightbox functionality).

For 1. I've tried various options (always setGallerySize: false) but somehow can't get it right with this setup of nav and main slider. I guess for 2. some CSS scripting has to be done. Any ideas?

Thanks!

htmagedev avatar Jul 14 '17 14:07 htmagedev