移动端开发的兼容问题

来源:互联网 发布:入骨相思知不知福禄 编辑:程序博客网 时间:2024/06/04 23:29

1、ios下input设置type=button属性disabled设置true,会出现样式文字和背景异常问题,使用opacity=1来解决

2、一些情况下对非可点击元素如(label,span)监听click事件,ios下不会触发,css增加cursor:pointer就搞定了

3、1px边框问题使用
xx:before{
content:”;
position: absolute;
top: 0;
left: 0;
border: 1px solid #ccc;
width: 200%;
height: 200%;
box-sizing:border-box;
-webkit-box-sizing:border-box;
-webkit-transform: scale(0.5);
transform: scale(0.5);
-webkit-transform-origin: left top;
transform-origin: left top;
}

4、input为fixed定位在ios下的bug问题,点击焦点input,input跳到中间位置,可以使用内容滚动框也是fixed来设置

5、移动端字体小于12px使用四周边框或者背景色块,安卓文字偏上bug问题,可以使用整体放大1倍再缩放,而且字体不要是奇数

6、在移动端图片上传图片 使用accept=”image/*” multiple,兼容低端机的问题

7、在h5嵌入app中,ios如果出现垂直滚动条时,手指滑动页面滚动之后,滚动很快停下来,好像踩着刹车在开车,有“滚动很吃力”的感觉self.webView.scrollView.decelerationRate = UIScrollViewDecelerationRateNormal;对webview设置了更低的“减速率”

8、click 300ms 延时响应 使用 Fastclick
window.addEventListener( “load”, function() {
FastClick.attach( document.body );
}, false );

9、input 有placeholder情况下不要设置行高,否则会偏上

10、移动端适配可以使用lib-flexible https://github.com/amfe/lib-flexible

原创粉丝点击