设置meta标签html
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
这个问题貌似只有再ios9中才有
解决方法:在input的父元素上添加相对定位就好了,很是神奇,具体由于啥不太清楚。。ios
style="postion:relative;"
目前有2个方法:web
//input输入框弹起软键盘的解决方案。 var bfscrolltop = document.body.scrollTop; $("input").focus(function () { document.body.scrollTop = document.body.scrollHeight; }).blur(function () { document.body.scrollTop = bfscrolltop; });
position: absolute; webkit-overflow-scrolling: touch; z-index:1; //js再控制blur //让页面向下滑动500 document.body.addEventListener('focusout', function () { window.scrollTo(0,500); })
个人解决方法是,让html和body固定100%(或者100vh),而后再在内部放一个height:100%的div,设置overflow-y: auto;和-webkit-overflow-scrolling: touch;app
.h100scroll { /* 模态框之类的div不能放在这个容器中 */ height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; overflow-scrolling: touch; }
注:ios里貌似不支持fixed。。。这里主要指absolute
在position:fixed/absolute内加入:post
-webkit-transform: translateZ(0);
抖动状况,则在内容区域,加入 :spa
overflow-y: auto;