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" />');
This also failed:
<input type='text' onfocus="return false">
And this:
jQuery("#locationLock input").focus(function(e){e.preventDefault();});
Any ideas?
By default, Chrome sets the zoom level to 100%. To manually adjust the settings, use the Ctrl key and “+” or “-” combos to increase or decrease the page magnification. If you are using a mouse, you can hold down the keyboard Ctrl key and use the mouse wheel to zoom in or out.
If you enlarge the field by increasing all dimensions by 16 / 12 = 133.33%, then reduce using scale() by 12 / 16 = 75%, the input field will have the correct visual size (and font size), and there will be no zoom on focus.
How to disable zoom on react-native web-view ,is there a property like hasZoom={false} (just an example) that can be included in the below web-view tag that can disable zooming.
The following worked for me (Android Galaxy S2):
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, user-scalable=no;user-scalable=0;"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With