Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync on nav slide click #8

Open
htmagedev opened this issue Jul 12, 2017 · 2 comments
Open

Sync on nav slide click #8

htmagedev opened this issue Jul 12, 2017 · 2 comments

Comments

@htmagedev
Copy link

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?

@desandro
Copy link
Member

desandro commented Jul 12, 2017

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 );
});

@htmagedev
Copy link
Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants