1.4.x callback methods - on init event not working
See original GitHub issueNew callback events
Is anyone else having an issue with the init event? I’m having trouble getting init to work at all.
With the following code the beforeChange and afterChange events work, but the init event doesn’t fire at all. I have tried version 1.4.0 and 1.4.1
My code looks like this:
$('.slider')
.on('init', function(event, slick){
// let's do this after we init the banner slider
...
console.log('slider was initialized');
})
.on('beforeChange', function(event, slick, currentSlide, nextSlide){
// then let's do this before changing slides
...
console.log('before change');
})
.on('afterChange', function(event, slick, currentSlide, nextSlide){
// finally let's do this after changing slides
...
console.log('after change');
});
Using 1.3.9 and the older callback method the onInit works
$('.slider').slick({
autoplay: true,
autoplaySpeed: 5000,
slidesToShow: 1,
slidesToScroll: 1,
dots: true,
lazyLoad: 'ondemand',
onInit: function() {
// let's do this after we init the banner slider
...
console.log('slider was initialized');
},
onBeforeChange: function() {
// then let's do this before changing slides
...
console.log('before change');
},
onAfterChange: function() {
// finally let's do this after changing slides
...
console.log('after change');
}
});
Issue Analytics
- State:
- Created 9 years ago
- Reactions:1
- Comments:22 (3 by maintainers)
Top Results From Across the Web
JQuery UI event callbacks not triggering when set in initializer
I have stumbled upon this type of problem myself. It seems that the bind events and the initializer events are not the same...
Read more >ORM Events - SQLAlchemy 1.4 Documentation
Note that this event only fires when the actual rollback against the database occurs - it does not fire each time the Session.rollback()...
Read more >bokeh.events — Bokeh 2.4.0 Documentation
The classes in this module represent these different events, so that callbacks can be attached and executed when they occur. It is possible...
Read more >pygame.event — pygame v2.1.4 documentation
Usually, this should be called once per game loop. Note: Joysticks will not send any events until the device has been initialized. The...
Read more >SugarCube v2 Documentation - Motoslave.net
For example, the following will not work because the macro parser will ... callback : (function) The function used to produce members of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You need to bind it before calling slick on the element
is there an event after slick is ready ?
in the init callback slick is not available yet 😃