2

我正在使用以下代码隐藏弹出窗口:

$(document).on('mouseup touchstart',function (event) {
  var container = $('#selected_thing');
  if (!container.is(event.target)                 // if the target of the click isn't the container...
  && container.has(event.target).length === 0) {  // ... nor a descendant of the container
      container.hide();
  }
});

mouseup鼠标点击事件touchstart和手指点击事件。

当用户的意图不是单击而是滚动(即点击并拖动)时,如何防止“点击”弹出窗口?

一个适用于最近的 iOS 和 Android 浏览器的解决方案将是更可取的。

4

0 回答 0