h5移动端兼容开发小结

1.事件绑定,.on(“click”,’class’,function(){}) 才是对所有class事件绑定,对新生成的元素绑定。

.

2.overflow-y:scroll 在苹果机上的滑动有问题;应该改成
-webkit-overflow-scrolling: touch;

.

3.设置滑动条的大小是:
::-webkit-scrollbar

.

4.Input type = number 在安卓和苹果手机上有时会出现样式错乱问题,除了修改问type=text外还能

input[type=number]::-webkit-inner-spin-button,  
input[type=number]::-webkit-outer-spin-button { 
        -webkit-appearance: none; 
        appearance: none; 
        margin: 0; 
}

.

5.JQ checkbox ; prop 和 attr 的区别 , 在获取html自带属性的时候用prop ,获取用户自定属性的时候用attr.

.

6.form表单,在ios微信开发会有点击文字有黑色屏幕一闪而过。
style=’-webkit-tap-highlight-color:rgba(255,0,0,0);

.

7.onclick 在手机上点击,特别是ios机会有200-300ms的延迟,解决办法是
fastclick.js

.

8.iso newdate() 2016/12/1 12:00:00
andirod 2016-12-1 12:00:00
需要兼容

.

9.ios浏览器,有时候会点击数字拨打电话,禁止代码:

.

10.禁止对div进行操作
pointer-events:none

.

11.ios端Jq的事件委托出问题。
不要给docuemnt,给父元素,并且给父元素添加样式 cursor: pointer;

.

12.iphone5s 用for in 会出现两次遍历,用来做计数器,就会出现问题

.

13.安卓手机上,点击a标签闪屏的问题
html{-webkit-tap-highlight-color:transparent}

.

14.iscroll5 默认点击事件失效,需要:
preventDefault: false

猜你喜欢

转载自blog.csdn.net/qq_24073885/article/details/72466290