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.

Second Carousel not synced with first carousel when autoplay enabled

See original GitHub issue

Here is the code i have

var heroCarousel = $(".hero-carousel");
var heroThumb = $(".carousel-thumb");
heroCarousel.slick({
    autoplay: true,
    autoplaySpeed: 5000,
    slidesToShow: 1,
    slideToScroll: 1,
    arrows: false,
    asNavFor: '.carousel-thumb',

});
heroThumb.slick({
    slidesToShow: 5,
    slidesToScroll:1,
    asNavFor:'.hero-carousel',
    focusOnSelect: true,
    arrows: false
});

The first carousel have autoPlay prop enabled, but when it’s updated the second slider is not updated, it still in the first position.

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:3
  • Comments:10

github_iconTop GitHub Comments

2reactions
pete-willardcommented, Apr 20, 2016

I too have encountered this problem. Thanks for the workaround @ariona!

2reactions
arionacommented, Dec 17, 2015

Well, this need more workaround using afterChange event

heroCarousel.on("afterChange",function(event, slick, currentSlide){
    // Remove current class from second slider
    heroThumb.find(".slick-current").removeClass("slick-current");

    // Add current class to the current slide
    heroThumb.find(".slick-slide").eq(currentSlide).addClass("slick-current");
});

This solve the problem for now, but it’s great to be implemented natively on the slick core.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Owl Carousel Won't Autoplay - Stack Overflow
The version does matter. Owl Carousel 2 uses "autoplay". Older version uses "autoPlay". Also worth noting, in version 2 you must use "autoplayTimeout"...
Read more >
AutoplayOptions | Swiper - v8.4.5
Object with autoplay parameters or boolean true to enable with default settings. example: const swiper = new Swiper('.swiper', { autoplay: { delay: 5000,...
Read more >
How to use the Carousel element - GemPages Help Center
When both functions are enabled, your slides will automatically advance and then loop back to the first slide. Autoplay Timeout: Set a time ......
Read more >
How to Enable Autoplay for SwiperJS React - YouTube
In this video I will quickly explain how to enable the autoplay feature in Swiper React based carousels.
Read more >
Building a Carousel Slider in Oxygen with OxyExtras
The sync is two ways. The cell index is actually synced. So no matter what method you use to navigate one carousel, the...
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