input标签添加上disable属性在移动端(ios)字体颜色及边框颜色不兼容的解决办法。
手机一些兼容性问题:
1.苹果手机输入框input:disabled显示模糊问题
input:disabled, input[disabled]{
color: #5c5c5c;
-webkit-text-fill-#5c5c5c;
border: 1px solid #5c5c5c;
-webkit-opacity:1;
opacity: 1;
}
注:disabled 默认是0.3,所以样式里一定要加 opacity:1
2.苹果手机使用弹框布局,字体垂直不居中问题
设置了display:flex,align-items:center;还需设置top
3.ios中position:fixed弹出框中的input出现光标错位的问题;
当弹出弹框时给body设置position:fixed;消失时恢复
4.(1)当使用默认的input时,要居右显示,可以设置direction:ltr;
(2)如果要用年月日时分秒,最好设置为type=datetime-local;如果要居右显示,通过onchange事件来把值写入指定的标签中,而input默认的值显示要padding-left:1000000000000,使页面看不了,不能使用display:none;
5.ios使用滑动加载数据时建议增加个开关,防止多次加载数据。
6.页面底部导航在触发键盘事件时会顶上去,解决方法如下:
var windheight =window.innerHeight;
var bottomx = document.getElementById('footer');
$(window).resize(function(){
var docheight = window.innerHeight;
if(docheight < windheight){
bottomx.style.position = 'static';
}else{
bottomx.style.position = 'fixed';
}
})
7.苹果手机如果使用input=search,弹出的键盘里没有“搜索”按钮,直接在input外面加上 <form class="search" action="javascript:return true;"></form>