Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect when slick slider initialises

I'm trying to fire some code when slick initializes. Apparently in the newest version 1.4 "callback methods have been deprecated and replaced with events."

This doesn't work for me though:

$('.spv-slider').on('init', function(event, slick){
    console.log("initialised")
});

what's wrong with it?

like image 475
user1937021 Avatar asked Jan 30 '15 13:01

user1937021


1 Answers

I'm not sure at which point you tried to initialize slickslider, but you have to do it after binding the init event.

So write your piece of code as you did and after that initialize the slider:

$('.spv-slider').on('init', function(event, slick){
    console.log("initialized")
});

And then:

$('.spv-slider').slick();
like image 81
der-lukas Avatar answered Oct 05 '22 11:10

der-lukas