javascript - Slick slider change speed after change - Stack Overflow

What i want achieve is to change autoplay speed when the first animation will be loaded.I found that sl

What i want achieve is to change autoplay speed when the first animation will be loaded.

I found that slick has afterChange function but I don't know how to use it.

My code:

  $(".home-slider-t").slick({
      dots: false,
      arrows: true,
      infinite: false,
      speed: 2500,
      slidesToShow: 1,
      autoplay: true,
      fade: true,
      autoplaySpeed: 6000
  });

I want to set autoplay speed to 15 000ms after first change. (infinite true)

What i want achieve is to change autoplay speed when the first animation will be loaded.

I found that slick has afterChange function but I don't know how to use it.

My code:

  $(".home-slider-t").slick({
      dots: false,
      arrows: true,
      infinite: false,
      speed: 2500,
      slidesToShow: 1,
      autoplay: true,
      fade: true,
      autoplaySpeed: 6000
  });

I want to set autoplay speed to 15 000ms after first change. (infinite true)

Share Improve this question edited May 2, 2020 at 9:21 Ed Lucas 7,3654 gold badges40 silver badges50 bronze badges asked Dec 4, 2017 at 13:45 Dawid KwiatońDawid Kwiatoń 111 silver badge2 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

Please note: If you provide a demo of your problem in jsfiddle help us to help you better because this is a plugin. anyways lets see what options we have:

First initialize the plugin

$(".home-slider-t").slick({
  dots: false,
  arrows: true,
  infinite: false,
  speed: 2500,
  slidesToShow: 1,
  autoplay: true,
  fade: true,
  autoplaySpeed: 6000,
});

and then use slick plugin events and methods:

$(".home-slider-t").on('afterChange', function(event, slick, currentSlide, nextSlide){
    $(".home-slider-t").slick('slickSetOption', 'autoplaySpeed', '15000');
});

p.s: Hope this code help to get idea of using methods and events of this plugin. i couldn't check the code because you didn't provide any jsfiddle but seems its fine.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745340219a4623291.html

相关推荐

  • javascript - Slick slider change speed after change - Stack Overflow

    What i want achieve is to change autoplay speed when the first animation will be loaded.I found that sl

    10小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信