Skip to content

Commit 53c2823

Browse files
author
Mauricio Gomez Aguinaga
committed
adding touch events for chosen-single to make it compatible with mobile browsers when using libraries like FastClic.js
adding the touch events to the proto version fixing a typo on chosen.proto.coffee
1 parent 0cd779d commit 53c2823

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

coffee/chosen.jquery.coffee

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ class Chosen extends AbstractChosen
6666
@form_field_jq.trigger("chosen:ready", {chosen: this})
6767

6868
register_observers: ->
69+
@container.bind 'touchstart.chosen', (evt) => this.container_mousedown(evt); return
70+
@container.bind 'touchend.chosen', (evt) => this.container_mouseup(evt); return
71+
6972
@container.bind 'mousedown.chosen', (evt) => this.container_mousedown(evt); return
7073
@container.bind 'mouseup.chosen', (evt) => this.container_mouseup(evt); return
7174
@container.bind 'mouseenter.chosen', (evt) => this.mouse_enter(evt); return

coffee/chosen.proto.coffee

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ class @Chosen extends AbstractChosen
4949
@form_field.fire("chosen:ready", {chosen: this})
5050

5151
register_observers: ->
52+
@container.observe "touchstart", (evt) => this.container_mousedown(evt)
53+
@container.observe "touchend", (evt) => this.container_mouseup(evt)
54+
5255
@container.observe "mousedown", (evt) => this.container_mousedown(evt)
5356
@container.observe "mouseup", (evt) => this.container_mouseup(evt)
5457
@container.observe "mouseenter", (evt) => this.mouse_enter(evt)

0 commit comments

Comments
 (0)