Skip to content

Commit 9e94f2f

Browse files
committed
Add touch event listeners
1 parent cab1c70 commit 9e94f2f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/range_slider.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,14 @@ export default class extends Controller {
338338

339339
addEvents() {
340340
this.slider.addEventListener("mousemove", this.move.bind(this));
341+
this.slider.addEventListener("touchmove", this.move.bind(this));
341342
this.slider.addEventListener("mouseup", this.drop.bind(this));
343+
this.slider.addEventListener("touchend", this.drop.bind(this));
344+
this.slider.addEventListener("touchcancel", this.drop.bind(this));
342345
this.pointerL.addEventListener("mousedown", this.drag.bind(this));
346+
this.pointerL.addEventListener("touchstart", this.drag.bind(this));
343347
this.pointerR?.addEventListener("mousedown", this.drag.bind(this));
348+
this.pointerR?.addEventListener("touchstart", this.drag.bind(this));
344349
window.addEventListener("resize", this.onResize.bind(this));
345350

346351
const pieces = this.slider.querySelectorAll("span");

0 commit comments

Comments
 (0)