I've got this code:
<select>
<option value="c">Klassen</option>
<option value="t">Docenten</option>
<option value="r">Lokalen</option>
<option value="s">Leerlingen</option>
</select>
Running in a full-screen web-app on iPhone.
When selecting something from this list, the iPhone zooms in on the select
-element. And doesn't zoom back out after selecting something.
How can I prevent this? Or zoom back out?
user-scalable=no is what you need, just so there's actually a definitive answer to this question
Try this:
DisablePinchZoom will be fired before the onchange so zoom will be disable at the time the onchange is fired. On the onchange function, at the end you can restore the initial situation.
Tested on an iPhone 5S
I am a bit late to the party, but I found a pretty neat workaround that solves this issue only with css manipulation. In my case I couldn't change the font size due to design reasons, and I couldn't disable zooming as well.
Since iPhone's will zoom form fields slightly if the text is set to less than 16 pixels, we can trick the iPhone to think that the font size is 16px and then transform it to our size.
For example, lets take the example when our text is 14px, so it does zoom because it is smaller than 16px. Therefore we can transform the scale, according to 0.875.
In the following example I've added the padding to show how to convert other properties accordingly.
I hope it helps!