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?
As answered here: Disable Auto Zoom in Input "Text" tag - Safari on iPhone
You can prevent Safari from automatically zooming in on text fields during user input without disabling the user’s ability to pinch zoom. Just add
maximum-scale=1
but leave out the user-scale attribute suggested in other answers.It is a worthwhile option if you have a form in a layer that “floats” around if zoomed, which can cause important UI elements to move off screen.
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
iPhone's will zoom form fields slightly if the text is set to less than 16 pixels. I'd suggest setting the mobile form field's text to be 16 pixels and then override the size back down for desktop.
The answers saying to disable zoom are unhelpful for partially sighted users may still want to zoom on smaller mobiles.
Example:
It is probably because the browser is trying to zoom the area since the font size is less than the threshold, this generally happens in iphone.
Giving a metatag attribute "user-scalable=no" will restrict the user from zooming elsewhere. Since the problem is with select element only, try using the following in your css, this hack is originally used for jquery mobile.
HTML :
CSS:
src: unzoom after selecting in iphone
I don't think you can't do anything about the behavior in isolation.
One thing you can try is keep the page from zooming at all. This is good if your page is designed for the phone.
Another thing you could try is using a JavaScript construct instead of the generic "select" statement. Create a hidden div to show your menu, process the clicks in javascript.
Good luck!
This seemed to work for my case in addressing this issue:
Suggested here by Christina Arasmo Beymer
Try adding this CSS to disable Ios' default styling:
This will also work on other elements that get special styling, like input[type=search].