【问题标题】:Disable jquery-chosen on touchmove to enable scroll on page在 touchmove 上禁用 jquery-chosen 以启用页面滚动
【发布时间】:2018-09-17 09:33:48
【问题描述】:

如果您在任何移动设备(如 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));

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

【问题讨论】:

    标签: jquery jquery-chosen


    【解决方案1】:

    我只通过注释解决了它

    //_this.container_mousedown(evt); 
    

    this.container.on('touchstart.chosen' 事件中。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-30
      • 2019-05-15
      • 2015-07-26
      • 2012-02-28
      • 2011-04-09
      相关资源
      最近更新 更多