question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Click slide to advance to center position?

See original GitHub issue

Such a great plugin, thanks.

In center mode, it would be nice to be able to click on a visible slide to promote it to the active position. Can you suggest an approach for this?

I added a ‘data-slide-index’ attribute to the slides manually and tried something like this…

$('.slick-slide').on('click', function(e){
  var slideIndex = $(this).data('slide-index');
  $('#my-carousel').slickGoTo(slideIndex);
});

But of course this all goes out the window once the cloned slides are taken into account. Suggestion?

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:1
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

31reactions
ssundheimcommented, Jun 20, 2015

Stefencova, thanks for getting me on the right track. That almost worked for me. I found better luck using the custom attribute ‘data-slick-index’ set by slick on each slide:

  $('.slick-slider').on('click', '.slick-slide', function (e) {
    e.stopPropagation();
    var index = $(this).data("slick-index");
    if ($('.slick-slider').slick('slickCurrentSlide') !== index) {
      $('.slick-slider').slick('slickGoTo', index);
    }
  });
3reactions
sebamedcommented, Aug 29, 2019

Is there any way to achieve this without using jquery and using only react version of slick carousel?

EDIT: there is, I just did not go through the whole documentation, my bad; focusOnSelect property in settings object does that

Read more comments on GitHub >

github_iconTop Results From Across the Web

Align and arrange objects on a slide
Press Shift to select multiple objects. Select Picture format > Align and select how you want to align them: Align Left, Align Center,...
Read more >
PowerPoint Tutorial: Perfectly Align Anything, Anywhere!
Click here: https://goo.gl/TBZibYThis week's tutorial is ... can pretty much center your PowerPoint elements in the center of your slide.
Read more >
How to Align Objects Quickly in PowerPoint - YouTube
How to Align Objects Quickly in PowerPoint. Align, distribute and rotate are common tools used in PowerPoint. Especially when you create ...
Read more >
How to align shapes in PowerPoint easily?
Click the 'remember shape position' button (or shortcut keys ALT + C), then navigate to the shape on the slide that you want...
Read more >
PowerPoint 2016: Aligning, Ordering, and Grouping Objects
To align objects to the slide: · Select the objects you want to align. · From the Format tab, click the Align command,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found