开发者

Disabling mobile Safari's focus event (zoom)

开发者_如何学Python

When clicking an input field on an iOS device, it will zoom in on that element. Can i disable this focus event?


I put up this gist which solves the problem. https://gist.github.com/2008932

The accepted solution is not correct, as it will cancel focus altogether, which prevents data entry.


I think you would be better to set the viewport:

<meta name="viewport" content="width=device-width, user-scalable=no" />

See this thread


 document.getElementById("idOfInputField").onfocus = function(){return false;}


Best solution to disable auto zoom in mobile devices on touch event

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜