Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

slick slider multiple sliders on one page

$('.slider-for').each(function(key, item) {

  var sliderIdName = 'slider' + key;
  var sliderNavIdName = 'sliderNav' + key;

  this.id = sliderIdName;
  $('.slider-nav')[key].id = sliderNavIdName;

  var sliderId = '#' + sliderIdName;
  var sliderNavId = '#' + sliderNavIdName;

  $(sliderId).slick({
    slidesToShow: 1,
    slidesToScroll: 1,
    arrows: false,
    fade: true,
    asNavFor: sliderNavId
  });

  $(sliderNavId).slick({
    slidesToShow: 4,
    slidesToScroll: 1,
    asNavFor: sliderId,
    dots: true,
    arrows: true,
    centerMode: false,
    focusOnSelect: true
  });

});
Comment

Multiple Slick Sliders On Same Page with same classes

$(document).ready(function() {
    var myCarousel = $(".slider-for:not(.slick-initialized)");
    myCarousel.each(function() {
        $(this).slick({});
    });
});
Comment

Multiple Slick Sliders On Same Page with same classes

$(function () {
    $('.slider-for').each(function(num, elem) {
        elem = $(elem);
        elem.slick({
            slidesToShow: 1,
            slidesToScroll: 1,
            arrows: false,
            draggable: false,
            fade: true,
            asNavFor: '.slider-nav'
        });

        elem.next('.slider-nav-thumbnails').slick({
            slidesToShow: 3,
            slidesToScroll: 1,
            asNavFor: '.slider-for',
            dots: false,
            arrows: false,
            vertical: true,
            draggable: false,
            centerMode: false,
            focusOnSelect: true,
            responsive: [
                {
                    breakpoint: 769,
                    settings: {
                        vertical: false
                    }
                }
            ]
        });
    });
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: useformik 
Javascript :: load data from json server into html using jquery 
Javascript :: how to get selected list item value in javascript 
Javascript :: get static props 
Javascript :: jquery option second 
Javascript :: find max value in array javascript 
Javascript :: js change number to string 
Javascript :: javascript convert array to matrix 
Javascript :: put new attribute on html tag using javascript 
Javascript :: mysql json extract escape 
Javascript :: remove first element of array javascript 
Javascript :: how to test if an element has a class in testing library 
Javascript :: dom queryselector 
Javascript :: javascript es6 find 
Javascript :: carousel react 
Javascript :: open another page js 
Javascript :: getting the value of pi in javascript 
Javascript :: startswith vowels in js 
Javascript :: prevent refresh react 
Javascript :: get user input node js console 
Javascript :: get url parameter nuxt 3 
Javascript :: babel debugging 
Javascript :: constructor function 
Javascript :: show a div in jquery 
Javascript :: how to cut off decimals in javascript 
Javascript :: jquery timer countdown 
Javascript :: initialize a map js 
Javascript :: what difference between react func and class components 
Javascript :: supertest express check response 
Javascript :: Learn how to use Js export and import. 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =