Adz*_*o13 5 javascript google-chrome touch
在 Chrome 浏览器中,我注意到使用“touchend”或“pointerup”事件时禁用的按钮元素仍然会触发。我在设备模拟模式下的 Chrome 桌面 (mac) 和 Surface 上的 Chrome 中看到了这一点。这在其他浏览器上似乎不存在问题。
// neither of these seem to have an effect on touch/pointer events
button.disabled = true;
button.setAttribute('disabled', 'disabled');
Run Code Online (Sandbox Code Playgroud)
明显的修复仅适用于鼠标事件,但我不想让它在触摸设备上触发的延迟时间。我假设这是 Chrome 的问题,而不是我的代码,但我想我会要求看看可能是我的问题,或者其他人是否找到了实际的解决办法。
我面临着同样的问题,正如 @bigless 所建议的,下面的 CSS 也对我有用。
button:disabled { pointer-events: none };
Run Code Online (Sandbox Code Playgroud)