所以我又遇到了这个插件的问题-PinchZoom.js这在 Apple 为 iOS 设备更新 13.4 之后开始发生。
问题是双击功能现在突然完全停止在 iOS 设备上运行。
具体测试可以引用插件演示页面:http://manuelstofer.github.io/pinchzoom/demo/pinchzoom.html
在 iOS 设备上,您将无法双击放大图像,而这在以前的 iOS 版本中运行良好。
我什至深入研究了插件的源代码,但我不确定是什么导致更新后双击在 iOS 设备中不起作用。
如果有人对此有任何想法/解决方法,那将非常有帮助。
谢谢
最佳答案
在所有浏览器上,touchstart
上曾经有 300-350 毫秒的延迟。事件。显然,在 iOS 上仍然存在。您可以通过在 touchstart
中记录点击事件和时间来测试它。事件监听器。
对于您的问题,您可以通过修改 pinchzoom.js 以使用 touchend
来解决它没有延迟而不是touchstart
,或通过阻止 touchstart
上的默认行为.
我选择了后者并添加了event.preventDefault()
到touchstart
事件监听器。您也可以这样做,直到开发人员提供官方解决方案。
el.addEventListener('touchstart', function (event) {
event.preventDefault(); //add this
if (target.enabled) {
firstMove = true;
fingers = event.touches.length;
detectDoubleTap(event);
}
});
关于javascript - Apple 更新 13.4 后,PinchZoom.js 无法在 iOS 设备上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62072906/