内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用
创建了一个html页面,其中包含<input>
类型为“text”的标记。当我在iPhone上使用Safari点击它时,页面会变大(自动缩放)。有人知道怎么禁用这个吗?
我也是用jQuery做的:
$('input[type=search]').on('focus', function(){ // replace CSS font-size with 16px to disable auto zoom on iOS $(this).data('fontSize', $(this).css('font-size')).css('font-size', '16px'); }).on('blur', function(){ // put back the CSS font-size $(this).css('font-size', $(this).data('fontSize')); });
当然,16px
字体大小会破坏设计。