Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

slick carousel slickGoTo doesn't work

Tags:

jquery

I'm using the slick carousel class for a slider. HTML:

<div class="map">
  <div>
    <div class="step">
      <div class="m_left"><a href="#" class="next-slide"> nextPage</a></p>
      </div>
      <div class="m_right"><img src="/bindella/images/map_tsc.jpg"></div>
    </div>
  </div>
  <div>your content</div>
  <div>your content</div>
  <div>your content</div>
</div>
</div>  

JS:

$(document).ready(function() {
  $('.map').slick({
    centerMode: true,
    adaptiveHeight: true
  });

  $('.next-slide').click(function() {
    $('.map').slickGoTo(1);
  });
});     

The function slickGoTo doesn't work. What is wrong?

like image 715
user1272597 Avatar asked Feb 17 '15 08:02

user1272597


2 Answers

Please try:

$('.slider').slick('slickGoTo', number);
like image 106
Sky Yip Avatar answered Sep 19 '22 19:09

Sky Yip


Try something like this mate.Its a small work around

$('.next-slide').click(function() {
  var slider = $('.map');
  slider[0].slick.slickGoTo(parseInt(2));
});              

Fiddle here

like image 42
Outlooker Avatar answered Sep 19 '22 19:09

Outlooker