禁止输入焦点的Android网页缩放 [英] Disable zoom on input focus in Android webpage
问题描述
这里的两难困境,我有一个网页(仅适用于Android设备),并在该页面我有一个输入框(文本框专),当它获得焦点的浏览器放大,我不希望它放大在 - 听起来很容易,对吧。
Here's the dilema, I have a webpage (only for android devices) and in that page I have an input box (a text box specifically) and when it gets focus the browser zooms in. I don't want it to zoom in - sounds easy, right?
在此处,它变得有趣:我必须要能够放大,一般这样就不多说了。
Here's where it gets fun: I have to be able to zoom in general so don't say
<meta name='viewport' content='user-scalable=0'>
对我来说这是行不通的。
That won't work for me.
此外,输入框不接收点击事件。这似乎是点击一个获得焦点编程另一个按钮时。
Also, the input box doesn't receive click events. It appears when another button is clicked a gets focus programmatically.
下面是我已经试过,他们已经失败了至今:
Here's what I've tried and they've failed so far:
jQuery('head meta[name=viewport]').remove();
jQuery('head').prepend('<meta name="viewport" content="width=720px;intial-scale=1.0;maximum-scale=1.0;user-scalable=no" />');
jQuery("#locationLock input").focus();
jQuery('head meta[name=viewport]').remove();
jQuery('head').prepend('<meta name="viewport" content="width=720px;intial-scale=1.0;maximum-scale=1.0;user-scalable=yes" />');
这也失败了:
<input type='text' onfocus="return false">
和这样的:
jQuery("#locationLock input").focus(function(e){e.preventDefault();});
任何想法?
推荐答案
我已经得到了你所有的坏消息。它现在已经6个月没有人正确地回答了这个问题。
Not possible!
I've got some bad news for you all. It's now been 6 months and no one has correctly answered the question.
此外,我已经完成了工作的项目和雇主。
Also I've finished working on that project and employer.
我不敢说,但正是我要的是不可能的。对不起人民。但我要离开这个问题活着,使人们可以看到的其他选项。
I'm afraid to say it, but exactly what I asked for is impossible. Sorry peoples. But I'm going to leave the question alive so people can see the other options.
这篇关于禁止输入焦点的Android网页缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!