Answer the question
In order to leave comments, you need to log in
How to make AsNavFor work with the nearest slider in slick slider, but not all?
Good evening!
Subject: dev.boichenko.space/remont
Scroll to the very bottom, there is a section "completed work" and each work has a slider. Implemented using two slick sliders, interdependent of each other:
$('.portfolio-slider-big').slick({
arrows: false,
asNavFor: '.portfolio-slider-little'
});
$('.portfolio-slider-little').slick({
prevArrow: "<span class='slick-prev'><i class='fas fa-angle-left'></i></span>",
nextArrow: "<span class='slick-next'><i class='fas fa-angle-right'></i></span>",
asNavFor: '.portfolio-slider-big',
slidesToShow: 3,
focusOnSelect: true
});
asNavFor: $(this).parent().find('.portfolio-slider-big', )
Answer the question
In order to leave comments, you need to log in
Came to the solution in another project. If you have several identical sliders, you just need to call them through each(), and then respectively access the desired elements through $(this), something like this:
$('.portfolio-slider-big').each(function(){
$(this).slick({
asNavFor: $(this).parents('.postfolio-slider-container').find('.portfolio-slider-little');
});
});
api.jquery.com/eq-selector
asNavFor: '.portfolio-slider-little:eq(0)'
asNavFor: '.portfolio-slider-big:eq(0)'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question