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.

Slick sync sliders out of sync by 1 item each time

See original GitHub issue

I’m trying to achieve a history / timeline effect using two Slick sliders using the sync function. I have everything setup and it seems to work except the second slider (the ‘navigation’) doesn’t work as in it’s one slide behind what is on the left slide.

There are four years, 1999, 2001, 2002 and 2005. It’s almost as if the slider directions are reversed for some reason. When you load the page, the nav starts on 1999 but on the left, the main content slider starts on 2005.

Example image… slick-sync-issue-gh

The HTML markup…

    <!-- ko if: hasItems() -->
    <div class="listings-list__items history-timeline-data" data-bind="foreach: items">
        <div class="history-entry">
            <img class="history-entry__image" data-bind="attr: { src: $data.PrimaryImageUrl }" />
            <div class="history-entry__content">
                <div class="history-entry__content-year" data-bind="text: Year"></div>
                <div class="history-entry__content-name" data-bind="text: Name"></div>
                <div class="history-entry__content-text" data-bind="text: Text"></div>
            </div>
        </div>
    </div>
    <!-- /ko -->
    <!-- ko if: hasItems() -->
        <div class="listings-list__items history-timeline-nav" data-bind="foreach: items">
            <div class="history-entry">
            <div class="history-nav-link" data-bind="text: Year"></div>
        </div>
    </div>
    <!-- /ko -->

The jQuery/Slick markup…

    // Initialise the Slick slider
    $(".history-timeline-data").slick({
        slidesToShow: 1,
        slidesToScroll: 1,
        vertical: true,
        centerMode: true,
        centerPadding: "0px",
        autoplay: false,
        infinite: true,
        arrows: false,
        swipe: true,
        verticalSwiping: true,
        asNavFor: ".history-timeline-nav"
    }), $(".history-timeline-nav").slick({
        slidesToShow: 8,
        slidesToScroll: 1,
        vertical: true,
        centerMode: true,
        centerPadding: "0px",
        autoplay: false,
        infinite: true,
        arrows: true,
        swipe: false,
        verticalSwiping: true,
        asNavFor: ".history-timeline-data"
    });

Steps to reproduce the problem

  1. Set up slider sync with two sliders
  2. Load the page up and slide through one of the sliders

What is the expected behaviour?

Both sliders to be in sync

What is observed behaviour?

The sliders are out of sync by 1.

More Details

  • Chrome v53 stable channel
  • Not sure, minified in system packages (latest?)
  • I don’t think so no

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
danieltj27commented, Oct 5, 2016

Well not so much support, but I found out the issue. It seems to be a bug with some options I had set.

Using both vertical and centerMode together as true causes the second slider to skip ahead by one. When I took center mode out of the settings (essentially false), it worked fine again. So not much of an issue for me due to the setup, but definitely a bug, that’s for sure.

1reaction
leggomuhgreggocommented, Oct 5, 2016

Hah, sorry: test* case

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiple Slick Sliders Issue - Stack Overflow
js plugin with its Slider Syncing feature. The issue I am having is that if I use multiple sliders on a single page,...
Read more >
WP Slick Slider and Image Carousel – WordPress plugin
A quick, easy way to add and display multiple WP Slick Slider and carousel using a shortcode. Also added Gutenberg block support.
Read more >
Can't manage to synchronise two Slick Carousel ... - Drupal
Hello everyone, My main goal is to have a Slider Syncing on my work ... I have two Slick Carousel, created by the...
Read more >
Splide - The lightweight, flexible and accessible slider/carousel
Splide is a lightweight, flexible and accessible slider/carousel, ... 1 Slide Per Move ... Splide sliders can be synchronized with one another.
Read more >
slick - the last carousel you'll ever need - Ken Wheeler
slick is a responsive carousel jQuery plugin that supports multiple breakpoints, ... slidesToShow: 1, slidesToScroll: 1 } } // You can unslick at...
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