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.

Add ability to use asNavFor for many slicks

See original GitHub issue

Currently only one slick supported as navigation for, but if you change method to this:

Slick.prototype.asNavFor = function(index) {
        var _ = this, asNavFor = _.options.asNavFor != null ? $(_.options.asNavFor) : null;
        asNavFor.each(function() {
            $(this).getSlick().slideHandler(index, true);
        });
    };

it would be possible to use multiple selectors in asNavFor

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
anneminfordcommented, Feb 17, 2018

I’ve got 2 instances of a slider on a page, they work perfectly apart from the dots only appear on the second slider? Any ideas?

jQuery(‘.slider-for’).each(function (idx, item) { var carouselId = “carousel” + idx; this.id = carouselId; var newClassFor = ‘#’+carouselId +‘.slider-nav’; jQuery(this).slick({ slidesToShow: 1, slidesToScroll: 1, arrows: false, fade: true, asNavFor: newClassFor }); });

jQuery(‘.slider-nav’).each(function (idx, item) { var carouselId = “carousel” + idx; this.id = carouselId; var newClass = ‘#’+carouselId +‘.slider-for’; console.log(newClass); jQuery(this).slick({ slidesToShow: 3, slidesToScroll: 1, asNavFor: newClass, dots: true, arrows:true, centerMode: false, focusOnSelect: true, }); });

0reactions
chrisharrisonkiwicommented, Apr 24, 2015

If anyone else finds my error coming up above, Here’s my patch:

Slick.prototype.asNavFor = function(index) {
    var _ = this, asNavFor = _.options.asNavFor != null ? $(_.options.asNavFor):null;
    if(asNavFor != null){
        asNavFor.each(function(item){
            $(asNavFor[item]).slick('getSlick').slideHandler(index, true);
        });
    }
};
Read more comments on GitHub >

github_iconTop Results From Across the Web

jQuery slick slider with multiple rows with asNavFor not ...
Works as wanted when $('.slider-nav') there is only one row, you can change rows: 2 to rows: 1 to $('.slider-nav'). How to get...
Read more >
Support asNavFor for Vanilla slick, else TypeError: l.options is ...
Then we started a new optionset with the thumbnail skin and ran into a javascript error: TypeError: l.options is undefined in slick.min.js:1: ...
Read more >
slick - the last carousel you'll ever need - Ken Wheeler
slick is a responsive carousel jQuery plugin that supports multiple breakpoints, CSS3 transitions, touch events/swiping & much more!
Read more >
slick-asNavFor - CodePen
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https. ↑ Insert...
Read more >
Adding a Slideshow to Drupal website using Slick - YouTube
In this video I've installed Slick Carousel to create a slideshow in my Drupal website.This is for a task of Google Code In....
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