Skip to content
Advertisement

slick slider make delay of start

is it possible to make delay of slider start… I don’t want to slider start immediatly, want it to wait 2 sec before start and then slide.

$(function() {
    $('.banner').slick({
      autoplay:true,
      autoplaySpeed:2000,
      centerMode: true,
      centerPadding: '50px',
      slidesToShow: 1,
      speed:2000,
      pauseOnFocus: false,
      pauseOnHover: false,
      pauseOnDotsHover: false,
    });

Advertisement

Answer

If you want this at initial page load then simply use a setTimeout() function like this,

var count = 0;
    setTimeout(()=>{
        count = 1;
        $('.banner').slick({
          autoplay:true,
          autoplaySpeed:2000,
          centerMode: true,
          centerPadding: '50px',
          slidesToShow: 1,
          speed:2000,
          pauseOnFocus: false,
          pauseOnHover: false,
          pauseOnDotsHover: false,

    },2000) // Initialize the amount of time to delay , Its 2seconds currently.

if(count == 1){
 $(function() {
        $('.banner').slick({
          autoplay:true,
          autoplaySpeed:2000,
          centerMode: true,
          centerPadding: '50px',
          slidesToShow: 1,
          speed:2000,
          pauseOnFocus: false,
          pauseOnHover: false,
          pauseOnDotsHover: false,
        });
      }
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement