javascript - slickGoTo wont work during animation -


i building slider slick 10 sliders. each 1 slice of horizontal slide of image.

if 1 of them clicked should slide same random index slickgoto. if slide being animated 1 slider finishes it's animation instead of going proper slide.

i tried stop animation $('.slick-track').stop(true, true); doesn't work.

any ideas on how can slickgoto go right slide or stop animation , call slickgoto?

html

<div class="your-class">     <img src="images/aaron_09.jpg" />     <img src="images/ferrier_09.jpg" />     <img src="images/hassan_09.jpg" />     <img src="images/heimz_09.jpg" />     <img src="images/joe_09.jpg" />     <img src="images/paul_09.jpg" />     <img src="images/savitha_09.jpg" />     <img src="images/vaughn_09.jpg" /> </div> <div class="your-class">     <img src="images/aaron_10.jpg" />     <img src="images/ferrier_10.jpg" />     <img src="images/hassan_10.jpg" />     <img src="images/heimz_10.jpg" />     <img src="images/joe_10.jpg" />     <img src="images/paul_10.jpg" />     <img src="images/savitha_10.jpg" />     <img src="images/vaughn_10.jpg" /> </div> 

js

$(document).ready(function(){     var slick_settings = {         slidestoshow: 1,         adaptiveheight: true,         dots: false,         arrows: false,         infinite: true,         speed: 1000     };      var slider_collection = $('.your-class');     var slick_collection = slider_collection.slick(slick_settings);     var slick_collection_length = slick_collection.length -1;// -1 since used indexes      // slide random slider left or right     function slide() {         var slider_key = math.floor(math.random() * slick_collection_length);         var slider = slider_collection[ slider_key ];         // pause on hover         if(slider_collection.filter(function() { return $(this).is(":hover"); }).length){             return;         }         // left or right         if(math.random() >= 0.5){             $(slider).slick('slicknext');         }         $(slider).slick('slickprev');     }     setinterval(slide, 2000);      // build image     $(slider_collection).click(function(e){         var slider_key = math.floor(math.random() * slick_collection_length);         $('.slick-track').stop(true, true); // doesnt stop animation         $(slider_collection).each(function(){             $(this).slick('slickgoto', slider_key);         });     }); }); 

i needed set waitforanimate: false option in git repos readme , not on website.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

c# - Retrieve google contact -

javascript - How to insert selected radio button value into table cell -