kenwheeler / slick

the last carousel you'll ever need
kenwheeler.github.io/slick
MIT License
28.34k stars 5.88k forks source link

Init event doesn't fire. #4147

Open mooseh opened 2 years ago

mooseh commented 2 years ago

the init method as described in the documentation doesn't fire.

I have tested other events and they work just fine, but init does not.

====================================================================

http://jsfiddle.net/627rxog3/

====================================================================

Steps to reproduce the problem

  1. create a slick carousel
  2. use the .on('init') method

====================================================================

What is the expected behaviour?

expected behaviour is to fire an event.

====================================================================

What is observed behaviour?

no init event is fired.

====================================================================

More Details

JamoCA commented 2 years ago

Any acknowledgement of this bug? I just encountered the same issue using Slick v1.8.1. init doesn't appear to do anything. (Is there 2.6.14 version? I see some reference to 1.9.0, but this repository only seems to provide a 1.8.1 version.)

We finally resorted to using doTimeout to poll for the slider buttons and then trigger Tippy.js to generate attractive, informative tooltips for the pager buttons.

JohnnyQuest1983 commented 1 year ago

Just commenting in case anyone else (i.e. me in 6 months) runs into this issue. Doesn't seem to be a bug. The docs state:

Note that this event should be defined before initializing the slider.

So this works:

$(".slider").on('init', function(slick){
    console.log("initted!")
}).slick({ ... })

But this does not:

$(".slider").slick({ ... }).on('init', function(slick){
    console.log("initted!")
})

The Fiddle in the OP comment defines the init function after Slick has initialized.