Disable jquery-chosen on touchmove to enable scroll on page

Viewed 248

If you touch a chosen (https://harvesthq.github.io/chosen/) drop-down container while you scroll on any mobile device (like an iPad) the menu will pop out and you won´t be able to scroll the page.

I tried modifying the code, by commenting out two lines and moving _this.container_mousedown(evt); like this:

this.container.on('touchstart.chosen', (function(_this) {
                return function(evt) {
                    //_this.container_mousedown(evt);
                };
            })(this));
            this.container.on('touchend.chosen', (function(_this) {
                return function(evt) {
                    _this.container_mousedown(evt);
                    //_this.container_mouseup(evt);
                };
            })(this));

It makes it possible to scroll, but the first touch event/click doesn´t work. The drop-down only flickers.

1 Answers

I solved it by only commenting out

//_this.container_mousedown(evt); 

in the this.container.on('touchstart.chosen' -event.

The action is triggered by the mousedown event anyway. Though this causes a delay of 300ms when opening.

Related