javascript - Slick Carousel unable to call Methods -


i have several instances of slick carousel gallery set , working properly. however, cannot call methods described in documentation. (http://kenwheeler.github.io/slick/)

whenever try target existing instance of carousel, following error: "uncaught typeerror: cannot read property 'changeslide' of undefined." i'm trying automatically goto next slide after gallery initiated.

i've put jsfiddle replicate issue: http://jsfiddle.net/d32x7nqp/

var gallery = $('.slick-container');     gallery.slick({         speed:100,         dots:true,         oninit: function(){             gallery.slicknext();         }     }); 

error:

uncaught typeerror: cannot read property 'changeslide' of undefined  

targeting this, $(this), $('.slick-container'), , gallery produce same exception. appreciated, thank you!!

edit

thanks sunand fix! dealing same issue, move method out of oninit callback. apparently slick instance not initialized when oninit called. here's correct code:

var gallery = $('.slick-container');     gallery.slick({         speed:100,         dots:true,     });  gallery.slicknext(); 

i'm noticing after upgrading slick.js lot of methods slickprev() etc gone. looks way call them seems be

$('selector').slick('slickprev'); 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -