From ae0fcfb42886850ec65a9d04c04484055f27eaac Mon Sep 17 00:00:00 2001 From: simeydotme Date: Sat, 23 Jan 2016 21:38:14 +0800 Subject: [PATCH] Add a check in `postSlide` for unslick. because `postSlide` was running after animation, it was posssible for the method to re-enable auto play moments before destroying the slide, leaving any `asNavFor` targets with two timers advancing them, and no way to clear the timer. fixes #1031 --- slick/slick.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/slick/slick.js b/slick/slick.js index b137048e2..3669d65bf 100644 --- a/slick/slick.js +++ b/slick/slick.js @@ -1569,20 +1569,24 @@ var _ = this; - _.$slider.trigger('afterChange', [_, index]); + if( !_.unslicked ) { + + _.$slider.trigger('afterChange', [_, index]); - _.animating = false; + _.animating = false; - _.setPosition(); + _.setPosition(); - _.swipeLeft = null; + _.swipeLeft = null; - if ( _.options.autoplay ) { - _.autoPlay(); - } + if ( _.options.autoplay ) { + _.autoPlay(); + } + + if (_.options.accessibility === true) { + _.initADA(); + } - if (_.options.accessibility === true) { - _.initADA(); } };