Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Slick slider on('afterChange')

I am trying to find option or method that gives me ability to change animation of active slider content before or after change. For example I have Slick slider called 'slider-header' and it has three <h1> tags inside like:

<div id="slider-header">
    <div>
        <h1>First header</h1>
        <h1>Second header</h1>
        <h1>Third header</h1>
    </div>
</div>

I would like to slideOut(to left side) the first header with a little delay, then second header with the same delay, third header as well and only THEN I would like to change for next slide.
After change on the next slide, I would like those headers to appear in the same way but from the OTHER side. I could reach only slide out to the left side with setTimeout() function and 'slickNext' method, but I have no idea how can I make them appear on the next slide from the other side in the same delay way.

like image 620
Slavik Ogura Avatar asked Oct 27 '25 02:10

Slavik Ogura


1 Answers

Slick slider has its own event called afterChange, and also as argument, it has currentSlide and nextSlide which you can use to make animations.

$('#slider-header > div').on('afterChange', function(event, slick, currentSlide, nextSlide){
    console.log(nextSlide);
});
like image 92
edonbajrami Avatar answered Oct 28 '25 16:10

edonbajrami



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!