本文介绍了Safari iPad:防止双击放大的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 iPad 版 Safari 上创建网站.我需要阻止双击事件的缩放,但我有两个问题:

I'm creating a site on Safari for iPad. I need to prevent the zoom on double-tapping event but I have two problems:

  • 双击不会产生任何事件,所以我不能使用event.preventDefault();"
  • 我只在满足某些条件时才需要这样做,所以我不能使用标签...如果我这样做,用户将永远无法放大我的页面.
  • a double tap doesn’t generate any events, so I can't use "event.preventDefault();"
  • I need to do this only when some conditions are fulfilled, so I can't use the tag "<meta name = "viewport" content = "user-scalable = no">"... If I did that, users could never zoom on my page.

我该如何解决这些问题?

How can I fix these problems?

推荐答案

Mobile Safari 不支持 javascript ondblclick 事件.Safari 将其解释为缩放".

Mobile Safari does not support the javascript ondblclick event. It's interpreted by Safari as a "zoom".

Raul Sanchez 发布了一个潜在的解决方案:http://appcropolis.com/implementing-doubletap-on-iphones-and-ipad/

Raul Sanchez has posted a potential solution:http://appcropolis.com/implementing-doubletap-on-iphones-and-ipads/

这篇关于Safari iPad:防止双击放大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 07:47