Skip to content

Commit c7bc2f6

Browse files
committed
Only trigger scrollTo when not currently sliding
1 parent b0db7aa commit c7bc2f6

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

public/js/slider.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@
152152
this.isInSingleSlideMode = false;
153153
this.noSlideClass = this.options.noSlide.substr(1);
154154
this.onResize = null;
155+
this.isSliding = false;
155156

156157
// Kickoff...
157158
this.init();
@@ -284,14 +285,17 @@
284285
},
285286

286287
slideTo: function slideTo($slides, isNext) {
287-
if (this.runBeforeCallback(isNext) === false) {
288+
if (this.isSliding || this.runBeforeCallback(isNext) === false) {
288289
return false;
289290
}
290291

292+
this.isSliding = true;
293+
291294
this.$viewport.scrollTo(this.getSlideToPosition($slides, isNext), this.options.slideSpeed, {
292295
onAfter: function () {
293296
this.updateArrows();
294297
this.runAfterCallback(isNext);
298+
this.isSliding = false;
295299
}.bind(this)
296300
});
297301
},

src/js/slider.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
this.isInSingleSlideMode = false;
8181
this.noSlideClass = (this.options.noSlide).substr(1);
8282
this.onResize = null;
83+
this.isSliding = false;
8384

8485
// Kickoff...
8586
this.init();
@@ -218,14 +219,17 @@
218219
},
219220

220221
slideTo: function ($slides, isNext) {
221-
if (this.runBeforeCallback(isNext) === false) {
222+
if (this.isSliding || this.runBeforeCallback(isNext) === false) {
222223
return false;
223224
}
224225

226+
this.isSliding = true;
227+
225228
this.$viewport.scrollTo(this.getSlideToPosition($slides, isNext), this.options.slideSpeed, {
226229
onAfter: function () {
227230
this.updateArrows();
228231
this.runAfterCallback(isNext);
232+
this.isSliding = false;
229233
}.bind(this)
230234
});
231235
},

0 commit comments

Comments
 (0)