Skip to content

Commit b07154c

Browse files
committed
Disable dragging when swiping with the mouse
1 parent c7bc2f6 commit b07154c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

public/js/slider.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,11 @@
227227
this.$slider.on('swipeleft', function () {
228228
this.slideTo(this.$slides, true);
229229
}.bind(this));
230+
231+
// No dragging when "swiping" with the mouse...
232+
this.$slider.on('dragstart', 'a, img', function (e) {
233+
e.preventDefault();
234+
});
230235
}
231236

232237
// Window resize event...

src/js/slider.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@
159159
this.$slider.on('swipeleft', function () {
160160
this.slideTo(this.$slides, true);
161161
}.bind(this));
162+
163+
// No dragging when "swiping" with the mouse...
164+
this.$slider.on('dragstart', 'a, img', function (e) {
165+
e.preventDefault();
166+
});
162167
}
163168

164169
// Window resize event...

0 commit comments

Comments
 (0)