在touchmove上禁用jquery选择以启用页面上的滚动

sup*_*nke 4 jquery jquery-chosen

如果您在任何移动设备(如iPad)上滚动时触摸选定的(https://harvesthq.github.io/chosen/)下拉容器,菜单将弹出,您将无法滚动页.

我尝试修改代码,通过注释掉两行并移动_this.container_mousedown(evt); 像这样:

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));
Run Code Online (Sandbox Code Playgroud)

它可以滚动,但第一次触摸事件/点击不起作用.下拉只会闪烁.

sup*_*nke 5

我只是通过评论来解决它

//_this.container_mousedown(evt); 
Run Code Online (Sandbox Code Playgroud)

this.container.on('touchstart.chosen'-event中.

无论如何,该动作都是由mousedown事件触发的.虽然这会导致打开时延迟300毫秒.