Klassen DocentenBest IT RecipesPrevent iPhone resizing to `select` in web applicationI have this code:<select> <option value="c">Klassen</option> <option value="t">Docenten</option> <option value="r">Lokalen</option> <option value="s">Leerlingen</option> </select> Work in a full-screen web application on the iPhone.When you select something from this list, the iPhone approaches the select element. And does not throw back after choosing something.How can I prevent this? Or change the scale?+72javascript css html5 iphone-web-appStijn Martens Jun 26 2018-11-11T00: 00Zsource share12 answersProbably because the browser is trying to enlarge the area because the font size is less than the threshold, this usually happens on the iphone.Providing the metatag attribute "user-scalable = no" will restrict the user from scaling elsewhere. Since the problem is only with the select element, try using the following in your css, this hack was originally used for jquery mobile.HTML: <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> CSS select{ font-size: 50px; } src: unzoom after choosing iphone+90Sasi Dhar Nov 20 2018-12-12T00: 00Zsource shareuser-scalable = no is what you need, just so there really is a definitive answer to this question <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> +50sciritai Jun 28 2018-11-22T00: 00Zsource shareThis seemed to work for my case in solving this problem: @media screen and (-webkit-min-device-pixel-ratio: 0) { select:focus, textarea:focus, input:focus { font-size: 16px; } } Offered here by Christina Arasmo Beimer+32Triptoph Jun 04 '13 at 0:20 2013-06-04 00:20source shareiPhone will slightly change the margins if the text is less than 16 pixels . I would suggest setting the text of the mobile form field to 16 pixels, and then override the size back for the desktop.Disabled answers are useless for partially visible users, and may still want to increase the number of mobile phones.Example: # Mobile first input, textarea, select { font-size: 16px; } # Tablet upwards @media (min-width: 768px) { font-size: 14px; } +23martinedwards 01 Oct '15 at 10:03 2015-10-01 10:03source shareI was a bit late for the party, but found a pretty neat workaround that solves this problem only with css manipulations. In my case, I could not change the font size for design reasons and could not turn off the scaling.Since the iPhone will slightly increase the size of the form margins if the text is set to less than 16 pixels, we can trick the iPhone into believing that the font size is 16 pixels and then convert it to our size.For example, let's take an example when our text is 14px, so it scales because it is less than 16px. Therefore, we can convert the scale in accordance with 0.875.In the following example, I added padding to show how to convert other properties accordingly. .no-zoom { font-size: 16px; transform-origin: top left; transform: scale(0.875); // 14px / 16px padding: 4.57px; // 4px / 0.875 } Hope this helps!+4Layor Zee Apr 10 '18 at 13:00 2018-04-10 13:00source shareTry the following: function DisablePinchZoom() { $('meta[name=viewport]').attr("content", ""); $('meta[name=viewport]').attr("content", "width=yourwidth, user-scalable=no"); } function myFunction() { $('meta[name=viewport]').attr("content", "width=1047, user-scalable=yes"); } <select id="cmbYo" onchange="javascript: myFunction();" onclick="javascript: DisablePinchZoom();"> </select> DisablePinchZoom will be launched before onchange, so the zoom will be disabled during the onchange bypass. In the onchange function, you can restore the original situation at the end.Tested on iPhone 5S+2Dario Brizio Jun 09 '14 at 2:51 p.m. 2014-06-09 14:51source shareiOS enlarges the page to display a larger input box if its font size is less than 16 pixels.only when you click on any field, this is the scaling of the page. so on click, we make it at 16px and then changed to the defaultthe code snippet below works fine for me and is targeted at mobile devices, @media screen and (max-width: 767px) { select:active, input:active,textarea:active{ font-size: 16px; } } +2nand-63 Feb 08 '19 at 10:01 2019-02-08 10:01source shareI donβt think you can do anything about isolation behavior.One thing you can try is not to scale the page at all. This is good if your page is for your phone. <meta name="viewport" content="width=device-width" /> Another thing you could try is to use the JavaScript construct, rather than the general "select" statement. Create a hidden div to show your menu, handle clicks in javascript.Good luck0Vineel Shah Jun 26 '11 at 11:01 2011-06-26 11:01source shareLike here, they answered: Disable auto-zoom when entering text "tag - Safari on iPhoneYou can prevent Safari from automatically enlarging text fields during user input without disabling users' ability to zoom in. Just add maximum-scale=1 , but don't specify the custom scale attribute suggested in other answers.This is a useful option if you have a shape in the layer that βfloatsβ when zoomed in, which can lead to the displacement of important user interface elements off the screen.<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">0daxmacrog Sep 28 '18 at 13:15 2018-09-29 13:15source shareTry adding this CSS to disable the default iOS style: -webkit-appearance: none; This will also work with other elements that receive special styles, such as input [type = search].0Abdul Sheikh Jan 01 '19 at 19:51 2019-01-01 19:51source shareI read about it for several hours and the best solution is jquery here. It also helps with the Next Tab option in iOS Safari. I also have input, but you can delete it or add as you wish. In essence, mousedown fires before the focus event and makes the browser think its 16px. In addition, focusing will work on the Next Tab function and repeat the process. $(function(){ $('input, select').on("mousedown focusout", function(){ $('input, select').css('font-size','16px'); }); $('input, select').on("focus", function(){ $('input, select').css('font-size',''); }); }) 0Nimrod5000 Apr 11 '19 at 0:09 2019-04-11 00:09source shareSet the font size "select" to 16 pixelsSelect {font size: 16 pixels; }0nasty Aug 20 '19 at 22:02 2019-08-20 22:02source shareMore articles:Graceful completion of the node.JS HTTP server - httpHow to associate a property of a javascript object with a hyphen in it? - javascriptCan I tell the Chrome script debugger to ignore jquery.js? - javascriptAndroid: changing program menu items programmatically - javaEnable / disable iPhone Safari scaling with Javascript? - javascriptHow to call a PHP class method from a JavaScript function - javascriptWhat is the real difference between "Bastard Injection" and "Poor Injection", - oopHow to enable content scrolling inside a module? - htmlIt is incorrect to use servicelocation instead of constructor injection to avoid writing factory class loads - javaArguments against inversion of control containers - inversion-of-controlAll Articles
I have this code:
<select> <option value="c">Klassen</option> <option value="t">Docenten</option> <option value="r">Lokalen</option> <option value="s">Leerlingen</option> </select>
Work in a full-screen web application on the iPhone.
When you select something from this list, the iPhone approaches the select element. And does not throw back after choosing something.
select
How can I prevent this? Or change the scale?
Probably because the browser is trying to enlarge the area because the font size is less than the threshold, this usually happens on the iphone.
Providing the metatag attribute "user-scalable = no" will restrict the user from scaling elsewhere. Since the problem is only with the select element, try using the following in your css, this hack was originally used for jquery mobile.
HTML:
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
CSS
select{ font-size: 50px; }
src: unzoom after choosing iphone
user-scalable = no is what you need, just so there really is a definitive answer to this question
This seemed to work for my case in solving this problem:
@media screen and (-webkit-min-device-pixel-ratio: 0) { select:focus, textarea:focus, input:focus { font-size: 16px; } }
Offered here by Christina Arasmo Beimer
iPhone will slightly change the margins if the text is less than 16 pixels . I would suggest setting the text of the mobile form field to 16 pixels, and then override the size back for the desktop.
Disabled answers are useless for partially visible users, and may still want to increase the number of mobile phones.
Example:
# Mobile first input, textarea, select { font-size: 16px; } # Tablet upwards @media (min-width: 768px) { font-size: 14px; }
I was a bit late for the party, but found a pretty neat workaround that solves this problem only with css manipulations. In my case, I could not change the font size for design reasons and could not turn off the scaling.
Since the iPhone will slightly increase the size of the form margins if the text is set to less than 16 pixels, we can trick the iPhone into believing that the font size is 16 pixels and then convert it to our size.
For example, let's take an example when our text is 14px, so it scales because it is less than 16px. Therefore, we can convert the scale in accordance with 0.875.
In the following example, I added padding to show how to convert other properties accordingly.
.no-zoom { font-size: 16px; transform-origin: top left; transform: scale(0.875); // 14px / 16px padding: 4.57px; // 4px / 0.875 }
Hope this helps!
Try the following:
function DisablePinchZoom() { $('meta[name=viewport]').attr("content", ""); $('meta[name=viewport]').attr("content", "width=yourwidth, user-scalable=no"); } function myFunction() { $('meta[name=viewport]').attr("content", "width=1047, user-scalable=yes"); } <select id="cmbYo" onchange="javascript: myFunction();" onclick="javascript: DisablePinchZoom();"> </select>
DisablePinchZoom will be launched before onchange, so the zoom will be disabled during the onchange bypass. In the onchange function, you can restore the original situation at the end.
Tested on iPhone 5S
iOS enlarges the page to display a larger input box if its font size is less than 16 pixels.
only when you click on any field, this is the scaling of the page. so on click, we make it at 16px and then changed to the default
the code snippet below works fine for me and is targeted at mobile devices,
@media screen and (max-width: 767px) { select:active, input:active,textarea:active{ font-size: 16px; } }
I donβt think you can do anything about isolation behavior.
One thing you can try is not to scale the page at all. This is good if your page is for your phone.
<meta name="viewport" content="width=device-width" />
Another thing you could try is to use the JavaScript construct, rather than the general "select" statement. Create a hidden div to show your menu, handle clicks in javascript.
Good luck
Like here, they answered: Disable auto-zoom when entering text "tag - Safari on iPhone
You can prevent Safari from automatically enlarging text fields during user input without disabling users' ability to zoom in. Just add maximum-scale=1 , but don't specify the custom scale attribute suggested in other answers.
maximum-scale=1
This is a useful option if you have a shape in the layer that βfloatsβ when zoomed in, which can lead to the displacement of important user interface elements off the screen.
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
Try adding this CSS to disable the default iOS style:
-webkit-appearance: none;
This will also work with other elements that receive special styles, such as input [type = search].
I read about it for several hours and the best solution is jquery here. It also helps with the Next Tab option in iOS Safari. I also have input, but you can delete it or add as you wish. In essence, mousedown fires before the focus event and makes the browser think its 16px. In addition, focusing will work on the Next Tab function and repeat the process.
$(function(){ $('input, select').on("mousedown focusout", function(){ $('input, select').css('font-size','16px'); }); $('input, select').on("focus", function(){ $('input, select').css('font-size',''); }); })
Set the font size "select" to 16 pixels
Select {font size: 16 pixels; }