最近项目做的是h5的手机移动端,在用苹果浏览器测试时,弹出框输入信息会自动拉伸屏幕,并且不会像安卓一样回来。

网上查找说设置浏览器自适应头,但是并没有效果,

 <meta name="viewport" content="width=device-width, initial-scale=1.0,minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">

后来看到一篇禁用事件,于是我尝试了一下解决了问题,在此记录一下。

由于用的vue.js,可以在idnex.html界面禁掉缩放事件,

<script>
window.onload = function () {
document.addEventListener('gesturestart', function (e) {
e.preventDefault();
});
document.addEventListener('dblclick', function (e) {
e.preventDefault();
});
document.addEventListener('touchstart', function (event) {
if (event.touches.length > 1) {
event.preventDefault();
}
});
var lastTouchEnd = 0;
document.addEventListener('touchend', function (event) {
var now = (new Date()).getTime();
if (now - lastTouchEnd <= 300) {
event.preventDefault();
}
lastTouchEnd = now;
}, false);
};
</script>

  

h5禁用手机input点击放大的更多相关文章

  1. H5音乐自动播放ios//禁止安卓手机图片点击

    定义音乐按钮 <div id="music-btn" class="o-play" style="width: 24px; height: 24 ...

  2. html图片上传阅览并且点击放大

                  关闭   qq_31540195的博客       目录视图 摘要视图 订阅 异步赠书:9月重磅新书升级,本本经典           程序员9月书讯      每周荐书: ...

  3. input点击修改样式

    <input id="geren" type="button" value="个人奖励" style="BORDER-TOP ...

  4. layui 上传图片回显并点击放大实现

    1.页面代码布局 <div class="layui-col-xs12 form-group"> <div class="layui-col-xs6&q ...

  5. 动画--android图片点击放大动画,并遮挡旁边的控件

    http://blog.csdn.net/s13488941815/article/details/40649823: 首先是点击放大可以使用android自带的缩放动画,因为要遮盖其他控件,就需要控 ...

  6. jquery插件jquery.LightBox.js之点击放大图片并左右点击切换图片(仿相册插件)

    该插件乃本博客作者所写,目的在于提升作者的js能力,也给一些js菜鸟在使用插件时提供一些便利,老鸟就悠然地飞过吧. 此插件旨在实现目前较为流行的点击放大图片并左右点击切换图片的效果,您可以根据自己的实 ...

  7. ios开发图片点击放大

    图片点击放大,再次点击返回原视图.完美封装,一个类一句代码即可调用.IOS完美实现 创建了一个专门用于放大图片的类,以下为.h文件 #import <Foundation/Foundation. ...

  8. angular中label包含input点击事件的问题

    问题:当点击input时,input不能勾选,单label内的其他区域点击均可控制input勾选. 分析:点击input时,$event.target.tagName   //INPUT, 点击img ...

  9. js限制图片大小、点击放大图片、点击在新开页面显示

    缩放图片到合适大小        function ResizeImages() {            var myimg, oldwidth, oldheight;            var ...

随机推荐

  1. P4python: python interface to Perforce API

    P4python is the python interface to Perforce API, it helps to do Perforce operations through python. ...

  2. Congestion Avoidance in TCP

    Congestion Avoidance in TCP Consequence of lack of congestion control When a popular resource is sha ...

  3. 五、mariadb遇到的坑——Linux学习笔记

    C#连接MySQL异常:The host localhost does not support SSL connections. 解决方案: 连接字符串添加如下语句. SslMode = none; ...

  4. 【Leetcode】【Medium】Best Time to Buy and Sell Stock

    Say you have an array for which the ith element is the price of a given stock on day i. If you were ...

  5. IEEP部署企业级网络工程-OSPF邻居关系故障排除

    OSPF邻居关系故障-现象与排除 一.OSPF邻居关系故障-现象与排除 1.OSPF建立邻居关系时,将检验hello报文中的Area ID .Autype.Authentication.network ...

  6. SqlParameter.Value = NULL 引发的数据库异常

    摘自:http://www.cnblogs.com/ccweb/p/3403492.html using (SqlCommand cmd = new SqlCommand()) { cmd.Conne ...

  7. SAP S/4HANA生产订单的BAdI增强点之Initialize方法

    在S/4HANA里创建生产订单时,有一个增强点WORKORDER_UPDATE: 这个CAUFVDB里存放的是生产订单抬头级别的数据: 我们来观察下运行时这个结构里存放的数据. 请大家用我github ...

  8. MongoDB插入文档

    db.collection.insertOne() 插入单个文档.db.collection.insertMany() 插入多个文档.db.collection.insert() 插入单/多个文档.  ...

  9. jemter多种方式查看结果树及正则的使用

    最近才发现jemter结果是有一种正则表达式匹配的显示方式,以前直接在TEXT下显示和来匹配正则,真是费时间,使用方式如下: 默认使用TEXT方式显示: 显示方式有以下几种: RegExp Teste ...

  10. Yii中POS和GET并用范例

    页面 <?php $form=$this->beginWidget('CActiveForm', array( 'id'=>'add-form', 'enableAjaxValida ...